Results 1 to 2 of 2

Thread: MYSQL Not Excluding Row ?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2009
    Posts
    968

    MYSQL Not Excluding Row ?

    I'm having this weird issue (Rope is currently around my neck ). Im using query below via PHP to display rows from a MYSQL database. The "private !- 1" part is not working, hence its still displaying the rows where "private is equal to 1".

    The strange thing is, that the "private !- 1" works fine when I remove this part "AND title LIKE '%$getSearch%' OR name LIKE '%$getSearch%' OR lang LIKE '%$getSearch%' OR raw LIKE '%$getSearch%'"

    Query not Working:
    PHP Code:
    mysql_query("SELECT * FROM players WHERE private != 1 AND title LIKE '%$getSearch%' OR name LIKE '%$getSearch%' OR lang LIKE '%$getSearch%' OR paw LIKE '%$getSearch%' "); 
    Working Query:
    PHP Code:
    mysql_query("SELECT * FROM players WHERE private != 1 "); 
    Can anyone see anything that I may be missing ?

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2009
    Posts
    968

    Re: MYSQL Not Excluding Row ?

    Got it, I needed to wrap my other conditions in parenthesis

    mysql_query("SELECT * FROM players WHERE private != 1 AND (title LIKE '%$getSearch%' OR name LIKE '%$getSearch%' OR lang LIKE '%$getSearch%' OR paw LIKE '%$getSearch%') ");

Posting Permissions

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



Click Here to Expand Forum to Full Width