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: [EMAIL PROTECTED]
> 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




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to