cs3mw
06-08-2007, 08:00 AM
Im trying to create a search function for a client tabble. In my table are two attributes firstname and surname which are seperate. Now what I want my search function to do is when a user types a name into a input box containing both the firstname and surname i want the search to do it on that name now the sql command i currently have is:
$sql = "SELECT * FROM client WHERE firstname like '%$name%' or surname like '%$name%'";
Now in my database I have a firstname Michael and a surname Whiteley, if i type in Mic then the search works fine but if i type in Michael Whiteley the full name then the search comes back as failed. Has anyone any ideas how I can fix this? Cheers
$sql = "SELECT * FROM client WHERE firstname like '%$name%' or surname like '%$name%'";
Now in my database I have a firstname Michael and a surname Whiteley, if i type in Mic then the search works fine but if i type in Michael Whiteley the full name then the search comes back as failed. Has anyone any ideas how I can fix this? Cheers