June 30th, 2000, 12:56 PM
SORRY, I'm german, my english isn't good to reed!
My problem is the follows:
I'm looking for a statement searching anything from a database. I use this one and i will get only exact answers!
$sql = "SELECT column FROM table WHERE(table.column LIKE '%$word%')";
In table there is f.i. "Hallo" and if I have a look about "hallo" I will get an Emty! If I have a look about "Hallo" I will get "Hallo"!
Can you help me, finding a statement wich will give back "Hallo" if I have ask "hallo"?
SORRY again my english! I hope you can understand what I'm looking for.
June 30th, 2000, 02:22 PM
$sql = "SELECT column FROM table WHERE lcase(table.column) REGEXP lcase($word)";
Using REGEXP is far superior to LIKE because you can do things such as REGEXP lcase($word1|$word2). This will return all with word1 or word2 in it.
Also the lcase(table.column) will turn everything into lowercase just for the query and make it a case insensitive query.