SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot Tikila's Avatar
    Join Date
    Jun 2007
    Location
    Toronto
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help wrapping a condition

    thank you for your help in advance.
    Would mysql interpret this query properly?
    PHP Code:
    ...WHERE type_id='$type_id' AND cat_id='$cat_id' OR maincat_id='$maincat_id' AND item_activated='1' 
    I have a GET var that will get either cat_id or maincat_id but all other conditions apply,i want something like this:
    PHP Code:
    WHERE type_id='$type_id' AND (cat_id='$cat_id' OR maincat_id='$maincat_id' ) AND item_activated='1' 

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,276
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by Tikila View Post
    i want something like this:
    that will work, the first one won't
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

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