Thread: Resolved PHP complex WHERE statement
View Single Post
Old 07-05-2011, 09:07 AM   PM User | #1
LSCare
Regular Coder

 
Join Date: Jun 2011
Location: Swindon, England
Posts: 124
Thanks: 3
Thanked 9 Times in 9 Posts
LSCare is an unknown quantity at this point
PHP complex WHERE statement

Hello,

Below is the code i am talking about:

PHP Code:
$response mysql_query("SELECT * FROM  `tData`  
    WHERE word1 LIKE '%"
.$q."%'
    OR conj LIKE '%"
.$q."%' 
    OR word2 LIKE '%"
.$q."%'
    OR username LIKE '%"
.$q."%'
    OR lineID LIKE '%"
.$q."%'
    ORDER BY `lineID` DESC LIMIT 0 , 10"
); 
What i need is to make it so that the statement only selects the code with 'visible' (another field) set to 1... I have tried adding:

AND visible = 1

between

OR lineID LIKE '%".$q."%'
and
ORDER BY `lineID` DESC LIMIT 0 , 10");

however this has not worked.

Last edited by LSCare; 07-05-2011 at 11:29 AM..
LSCare is offline   Reply With Quote