Results 1 to 21 of 21
Thread: - MySQL . :)
Hybrid View
-
13th March 2009 12:12 #1
- MySQL . :)
. MySQL . - :
Categories -> Id | Name
Destinations -> Id | Name | ... | Category
Offers -> Id | Did | Name | ...
Did destination id Did = Id ( Destinations);
Category Id- - Id (Categories) .
, .
:
$_categoryId , ( ).Code:SELECT o.Name AS offerName, o.Did, c.Name AS categoryName, de.Name AS destinationName FROM ".OFFERS." AS o INNER JOIN ".DESTINATIONS." AS de ON (de.Id = o.Did) INNER JOIN ".CATEGORIES." AS c ON FIND_IN_SET(c.Id, de.Category) WHERE FIND_IN_SET(".$_categoryId.", de.Category) ORDER BY o.Id DESC LIMIT ".$mainPaging.", ".$perpage."
, "" 2, 3 , , .
... .
-
13th March 2009 12:55 #2
:
Code:select offers.name, offers.did, categories.name, destinations.name from offers inner join destinations on offers.did=destinations.id inner join categories on categories.id=destinations.category where destinations.category=$category ORDER BY o.Id DESC LIMIT ".$mainPaging.", ".$perpage."
-
13th March 2009 13:15 #3
-
13th March 2009 15:52 #4?Code:
select offers.name, offers.did, categories.name, destinations.name from offers inner join destinations on offers.did=destinations.id inner join categories on categories.id=destinations.category where destinations.category like '$category,%' or destinations.category like '%,$category,%' or destinations.category like '%,$category' ORDER BY o.Id DESC LIMIT ".$mainPaging.", ".$perpage."
-
13th March 2009 15:11 #5
Category ?
, - , -- , .
find_in_set , , .
, .
-
13th March 2009 15:26 #6
-
13th March 2009 15:54 #7
, -, FIND_IN_SET , .
, - '00-11-22', ID- --!
.
. redundancy - , (, ).
-
13th March 2009 16:46 #8
-
13th March 2009 17:04 #9
SELECT ....
FROM offers o
LEFT JOIN destinations d ON (d.id=o.did)
WHERE FIND_IN_SET($catid, d.cat_ids)>0
? , -- ( ).
, did.
-
13th March 2009 17:10 #10. .$_offersQuery = @mysql_query("SELECT o.Name AS offerName, o.Did FROM ".PREFIX_OFFERS_B." AS o INNER JOIN ".PREFIX_DESTINATIONS_B." AS de ON (de.Id = o.Did) WHERE FIND_IN_SET(".$_categoryId.", de.Category) ORDER BY o.Id DESC LIMIT ".$mainPaging.", ".$perpage."") or die(mysql_error());
...
-
13th March 2009 17:23 #11
-
13th March 2009 17:26 #12
-
13th March 2009 19:07 #13
. MySQL . 320 .

. .GB-EP43-DS3^PDC E2160^4x1GB Elixir^ ASUS EN7300GE
^160GB Hitachi 7.2k rpm^300W FPS PNR^19" Turbo-X HD900 TFT LCD P-MVA
-
13th March 2009 19:23 #14
, , , ...

- . .
tedych, FIND_IN_SET - .
- - .
''? * *
- !
...
-
13th March 2009 21:11 #15
-
14th March 2009 07:59 #16
-
14th March 2009 11:11 #17
, .. , , , .
z0ne , , join- , . , .
- , - ѝ , , , , .
. FIND_IN_SET ,
. 50-100 , - !
.
, - ? , , , , , 10- . ( ). .
.
( 100 . 1/10 .), , , - , .
, , , -, .
.
-
14th March 2009 14:05 #18
-
16th March 2009 10:54 #19Registered User
Join Date: Jul:2001
Location: Redmond, USA
Posts: 1,699
... , "-" .
- : The Daily WTF?Soltek 75FRN2-RL bred "B" 1700+ : 1466@2300(11.5x200) 1.85V 512 MB DDR333 TwinMOS: 11-3-3-2@2.8V Leadtek Geforce4Ti 4200 128 MB : 300/600 80GB Seagate 7200.7 CDROM 48x BenQ Enermax EG365P-VE/FCA 350W Creative DT2200 5.1 Middle Tower Water Cooling
-
20th March 2009 22:01 #20Registered User
Join Date: Jul:2005
Location: Sofiq
Posts: 2,798
bitwise set FIND_IN_SET. set-a 1,2,4 .. 2^n. -:
$_categoryIdCode:$_offersQuery = @mysql_query(" SELECT o.Name AS offerName, o.Did FROM ".PREFIX_OFFERS_B." AS o INNER JOIN ".PREFIX_DESTINATIONS_B." AS de ON (de.Id = o.Did) WHERE ".$_categoryId." & de.Category ORDER BY o.Id DESC LIMIT ".$mainPaging.", ".$perpage."") or die(mysql_error());
set SELECT categoryId+0.
Last edited by _ShadoW_; 20th March 2009 at 22:09.
-
21st March 2009 16:13 #21




Reply With Quote


Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in