Page 1 of 1

Restricted Search

Posted: Tue Sep 14, 2004 11:07 pm
by Base
I am coding a search function for a website. The idea is, the user can enter a search input, but can only search results in their company. Unfortunately, the search doesn't restrict the user's search. This is my code:

Code: Select all

$query = "SELECT 
			user_id, 
			CONCAT(lastname, ', ', firstname) AS lastname, 
			email, 
			company, 
			position, 
			results, 
			DATE_FORMAT(timestamp, '%m/%d/%y'), 
			timestamp  
		  FROM dbci_user_surveys 
		  WHERE user_id LIKE '%$search%'
		  OR firstname LIKE '%$search%'
		  OR lastname LIKE '%$search%'
		  OR email LIKE '%$search%'
		  OR position LIKE '%$search%'
		  AND company = '$coco'";
$coco = company variable

Posted: Tue Sep 14, 2004 11:12 pm
by feyd
hint: use parens..

Posted: Thu Sep 16, 2004 12:00 am
by Base
Its not working. Any other suggestions, preferably examples.

Thanks . . .

Posted: Thu Sep 16, 2004 12:05 am
by feyd
what did you try?

Posted: Thu Sep 16, 2004 12:27 am
by Base
I've already deleted what I tried and it will take me a while to redo it. I'm running out of time and I need help asap.