Results 1 to 21 of 21

Thread: - MySQL . :)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    White awesomeness z0ne's Avatar
    Join Date: Feb:2002
    Location: o
    Posts: 13,331

    - MySQL . :)

    . MySQL . - :

    Categories -> Id | Name

    Destinations -> Id | Name | ... | Category

    Offers -> Id | Did | Name | ...

    Did destination id Did = Id ( Destinations);
    Category Id- - Id (Categories) .

    , .

    :

    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."
    $_categoryId , ( ).

    , "" 2, 3 , , .

    ... .

  2. #2
    Registered User iMarh's Avatar
    Join Date: May:2002
    Location:
    Posts: 373
    :

    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."
    Last edited by iMarh; 13th March 2009 at 13:01.

  3. #3
    White awesomeness z0ne's Avatar
    Join Date: Feb:2002
    Location: o
    Posts: 13,331
    Quote Originally Posted by iMarh View Post
    :

    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."
    , FIND_IN_SET, "Category" - "11,22,41".

  4. #4
    Registered User iMarh's Avatar
    Join Date: May:2002
    Location:
    Posts: 373
    Quote Originally Posted by z0ne View Post
    , FIND_IN_SET, "Category" - "11,22,41".
    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."
    ?

  5. #5
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    Category ?
    , - , -- , .
    find_in_set , , .

    , .

  6. #6
    White awesomeness z0ne's Avatar
    Join Date: Feb:2002
    Location: o
    Posts: 13,331
    Quote Originally Posted by tedych View Post
    Category ?
    , - , -- , .
    find_in_set , , .

    , .
    , , - - . ( ), , (Destinations) .

  7. #7
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    , -, FIND_IN_SET , .
    , - '00-11-22', ID- --! .
    . redundancy - , (, ).

  8. #8
    White awesomeness z0ne's Avatar
    Join Date: Feb:2002
    Location: o
    Posts: 13,331
    Quote Originally Posted by iMarh View Post
    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."
    ?
    .

    Quote Originally Posted by tedych View Post
    , -, FIND_IN_SET , .
    , - '00-11-22', ID- --! .
    . redundancy - , (, ).
    ... .

    .. ! ...
    Last edited by z0ne; 13th March 2009 at 16:55.

  9. #9
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    SELECT ....
    FROM offers o
    LEFT JOIN destinations d ON (d.id=o.did)
    WHERE FIND_IN_SET($catid, d.cat_ids)>0

    ? , -- ( ).
    , did.

  10. #10
    White awesomeness z0ne's Avatar
    Join Date: Feb:2002
    Location: o
    Posts: 13,331
    $_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());
    . . ...

  11. #11
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    Quote Originally Posted by z0ne View Post
    ... ...
    .

  12. #12
    White awesomeness z0ne's Avatar
    Join Date: Feb:2002
    Location: o
    Posts: 13,331
    Quote Originally Posted by tedych View Post
    .
    , . Id ... - .

    .

  13. #13
    Registered User Freestyler_BG's Avatar
    Join Date: Jul:2005
    Location:
    Posts: 413
    . 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

  14. #14
    ! vbTheKing's Avatar
    Join Date: Sep:2003
    Location:
    Posts: 4,138
    , , , ...
    - . .
    tedych, FIND_IN_SET - .
    - - .
    ''? * *
    - !
    ...

  15. #15
    White awesomeness z0ne's Avatar
    Join Date: Feb:2002
    Location: o
    Posts: 13,331
    Quote Originally Posted by vbTheKing View Post
    , , , ...
    ? / , , , - . tedych , - .

    Quote Originally Posted by vbTheKing View Post
    - . .
    . . Id- - .. .

    Quote Originally Posted by vbTheKing View Post
    tedych, FIND_IN_SET - .
    , => .

    Quote Originally Posted by vbTheKing View Post
    - - .
    .

    Quote Originally Posted by Freestyler_BG View Post
    . MySQL . 320 .
    . .
    100 , . 10 ?

    , , .

  16. #16
    Registered User Freestyler_BG's Avatar
    Join Date: Jul:2005
    Location:
    Posts: 413
    Quote Originally Posted by z0ne View Post
    10 ?
    - 24 , UNION - 47
    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

  17. #17
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    , .. , , , .
    z0ne , , join- , . , .

    - , - ѝ , , , , .

    . FIND_IN_SET , . 50-100 , - ! .
    , - ? , , , , , 10- . ( ). .
    .
    ( 100 . 1/10 .), , , - , .

    , , , -, .
    .

  18. #18
    White awesomeness z0ne's Avatar
    Join Date: Feb:2002
    Location: o
    Posts: 13,331
    . REGEXP, ENUM . - - - . , Id-ta.

  19. #19
    Registered 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

  20. #20
    Registered User
    Join Date: Jul:2005
    Location: Sofiq
    Posts: 2,798
    bitwise set FIND_IN_SET. set-a 1,2,4 .. 2^n. -:
    Code:
    $_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());
    $_categoryId set SELECT categoryId+0.
    Last edited by _ShadoW_; 20th March 2009 at 22:09.

  21. #21
    White awesomeness z0ne's Avatar
    Join Date: Feb:2002
    Location: o
    Posts: 13,331
    Quote Originally Posted by _ShadoW_ View Post
    bitwise set FIND_IN_SET. set-a 1,2,4 .. 2^n. -:
    Code:
    $_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());
    $_categoryId set SELECT categoryId+0.
    - . .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |