I've been reading tutorials and have learned nothing new. I have a table of customers. The customer's first and last names are stored in separate columns. I want to write a query that can search for customers by name, either first, last or BOTH.
Here's what I've got:
$queryyy = "
SELECT *
FROM `customers`
WHERE
`first_name1` LIKE '".mysql_real_escape_string($_GET['custname'])."%'
OR `last_name1` LIKE '%".mysql_real_escape_string($_GET['custname'])."'
AND `status` = 'active'
LIMIT 6
";
If I want to find "Lindsay Thompson", I can query for "lindsay", or for "Thompson" and get the results I want, but if I query for "lindsay thompson" I get nothing.
I feel like I'm missing the point of the wildcards, or not using them properly. Can someone please explain this to me and correct my query..
Thanks