View Single Post
  #1 (permalink)  
Old May 9th, 2008, 11:11
meth8200 meth8200 is offline
Junior Member
Join Date: Feb 2008
Location: UK
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Search Bar CONCAT query

Hi People,

If anyone can help please?

I've got a search bar and for example im trying to search the name billy brown.

this is my query:

$query = "SELECT id, CONCAT(forename,' ',surname) AS Com

FROM contacts

WHERE CONCAT(contacts.forename = '$search' AND contacts.surname = '$search') || contacts.forename LIKE '$search%' || contacts.surname LIKE '$search%'";

The outcome to all this is that it will display the name "Billy Brown" even if i only type Billy or Brown, this works but what if someone types in the whole name "Billy Brown" no results are displayed.

Any solutions?

Thanks

Reply With Quote