RE: [PHP-DB] how to do a search in mysql database for multiple keywords??
| From: | Dave Watkinson | Date: | Mon, 15 Oct 2001 08:08:43 +0000 |
| Subject: | RE: [PHP-DB] how to do a search in mysql database for multiple keywords?? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-13319@lists.php.net to get a copy of this message | ||
SELECT
<columnlist>
FROM
<tablename>
WHERE
<column to be searched>
LIKE
'%<word1>%'
AND
<column to be searched>
LIKE
'%<word2>%'
AND
<column to be searched>
LIKE
'%<word3>%'
for example...
SELECT uid, name, address, email FROM people WHERE address LIKE
'%london%' AND address LIKE '%baker%' AND address LIKE '%221b%'
In MySQL the % sign is the wildcard, so '%baker%' will look for all
instances containing baker. Similarly baker% will match all strings
starting with baker and baker% will match all strings ending in baker.
Hope this helps
Dave
-----Original Message-----
From: Nicklas Bondesson [mailto:nicklas.bondesson@eds.com]
Sent: 15 October 2001 09:06
To: php-db@lists.php.net
Subject: [PHP-DB] how to do a search in mysql database for multiple
keywords??
need some help on this.
any ideas??
/nicke
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net