Restricted Search
Posted: Tue Sep 14, 2004 11:07 pm
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:
$coco = company variable
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'";