I am making a VERY simple search for my database here at work. But for some reason I can't get the search limited by user.
Here is the code I want to work:
$query = "SELECT lastname, firstname FROM personnel WHERE personnel.UID = '$UID' AND personnel.lastname REGEXP '.$lname.'";
Here is the code that does work:
$query = "SELECT lastname, firstname FROM personnel WHERE personnel.lastname REGEXP '.$lname.'";
My situation is, I have users who login to the database. They can then view information specifically for them. I assign the user an id (UID). All the information for them has UID in the table. The search is a simple REGEXP match on the users last name. (I know, it's not the best way, but it REALLY is all I need). But I am also trying to match it with their UID. That way they only get the information specifically for them. If I don't try to match with UID the search returns results... but not only info for that user. If I try to match, the search simply returns nothing. No errors either.
Wow, I hope I explained that ok.
Thanks for any help in advance!
chadT