mySQL query - command "LIKE" OR "="
| From: | Harry.de | Date: | Fri, 28 Mar 2003 22:37:48 +0000 |
| Subject: | mySQL query - command "LIKE" OR "=" | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-141516@lists.php.net to get a copy of this message | ||
Hi,
i want to make a mySQL query where the result should be
in $result1
any sting with a phrase of $search
in $result2
any sting with the exact phrase of $search
$result1 works fine, but $result2 gives out an empty sting
$result1 = mysql_query("SELECT name FROM table WHERE name LIKE
'%".strtolower($search)."% ");
$result2 = mysql_query("SELECT name FROM table WHERE name =
'%".strtolower($search)."% ");
e.g.
row 1 in name = "my big appletree in the garden"
row 2 in name = "my big apple in the garden"
so the result should be in $result2 with $search="apple"
2
Can anybody help me
Harry