Forum Moderators: coopster
I have a table full of clients.
I want to be able to search by any field and pull up the record of clients that match the search.
Shrunk down Example Database:
+----------------------+
¦Clients
¦----------------------¦
¦1. name: Miller
¦----------------------¦
¦2. name: McConkey
+----------------------+
So I tried using the LIKE clause in the SQL query but it didn't work how I would have expected it to.
select * from clients where 'name' LIKE '%m%'
Works Just as I would expect and selects both entires Miller and McConkey.
However;
select * from clients where 'name' Like '%mcc%'
My intuition tells me that this should select the McConkey record... MySql actually selects nothing. But on the plus side it doesn't give me an error.
So am I just miss using the LIKE command? I know there must be a way to search a db, I mean what good is a database full of information if you can't search through it?
I know that if I wanted to I could select the entire database and then use the String manipulation commands in php to sort them out but that seems grossly inefficent.
Thanks in advance for any help.
-Chris McConkey