RE: [PHP] mySQL query - command "LIKE" OR "="
| From: | Jennifer Goodie | Date: | Fri, 28 Mar 2003 22:39:39 +0000 |
| Subject: | RE: [PHP] mySQL query - command "LIKE" OR "=" | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-141517@lists.php.net to get a copy of this message | ||
= does not take the wildcard (%).
-----Original Message-----
From: Harry.de [mailto:harald.mohring@gmx.de]
Sent: Friday, March 28, 2003 2:38 PM
To: php-general@lists.php.net
Subject: [PHP] mySQL query - command "LIKE" OR "="
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php