RE: [PHP] wildcard search?
| From: | John W. Holmes | Date: | Mon, 11 Nov 2002 21:48:56 +0000 |
| Subject: | RE: [PHP] wildcard search? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-123892@lists.php.net to get a copy of this message | ||
You'll do it in the database, not PHP.
Look into using LIKE in your query...
SELECT * FROM yourtable WHERE column LIKE '%searchterm%'
The % characters are wildcards that'll match any amount of characters.
You can use _ to match a single character.
You could also look at FULL-TEXT indexing in MySQL to create a better
search feature.
---John Holmes...
> -----Original Message-----
> From: Håkan [mailto:hw2k@barrysworld.com]
> Sent: Monday, November 11, 2002 4:43 PM
> To: php-general@lists.php.net
> Subject: [PHP] wildcard search?
>
> I'm trying to make a small and simple search function, but it only
works
> for
> exact searches, and I can't figure out how to make a wildcard search,
if I
> do it in the php or in the mysql_query, can't really find anything
about
> it
> and I don't know what to look for on php.net
>
> Håkan
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php