Re: wildcard in mysql search with php
| From: | Russ Michell | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: wildcard in mysql search with php | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-13478@lists.php.net to get a copy of this message | ||
Sure use:
SELECT * FROM <table> WHERE foo LIKE '%$bar%'
selects all records where 'bar' is found somewhere in the search string.
See also: http://www.mysql.com/doc/S/t/String_comparison_functions.html
HTH :-)
Russ
On Thu, 18 Oct 2001 15:57:56 +0200 "Thomas \"omega\" Henning"
<tomi@mediasoft.ro> wrote:
> Hello all,
>
> Is there a way to use wildcards in search in a mySQL db?
> e.g. I have a dbase of over 24000 records and i can only search exact
> matches is there a way to search something like this : *admin* in mySQL? Or
> i have to do it by hand in PHP?
>
> Thanks
> Sir Thomas "omega" Henning
>
>
>
> --
> 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
>
#-------------------------------------------------------#
"Believe nothing - consider everything"
Russ Michell
Anglia Polytechnic University Webteam
Room 1C 'The Eastings' East Road, Cambridge
e: r.j.michell@apu.ac.uk
w: www.apu.ac.uk/webteam
www.theruss.com
#-------------------------------------------------------#