Hi All,
I’m creating a simple search function on my site so that users can search for people via first name, last name or position in the company:
$query = "SELECT * FROM itl_users WHERE user_fname='$user_fname' OR user_lname='$user_lname' OR user_position='$user_position';";
I would like for results to be returned even if only a part of the requested string is found, eg. if you search for Manager, the search will return any positions that include the word “manager”, not just results with ONLY the string “manager”.
The MySQL site doesn’t seem to be much help with the WHERE clause, but I gather that using the * symbol is the way to go. I can’t seem to work it out though. I’ve tried:
$query = "SELECT * FROM itl_users WHERE user_fname='$user_fname*' OR user_lname='$user_lname*' OR user_position='$user_position*';";
and
$query = "SELECT * FROM itl_users WHERE user_fname='$user_fname'* OR user_lname='$user_lname'* OR user_position='$user_position'*;";
Any help or links appreciated, thanks for your time
C