select * from table_name where col1 like '%' and col2 like '%' and col3
As your default is %, then this is easy.
Its all in the mysql manual, Section 18.104.22.168 String Comparison Functions.
CÚsar Aracena wrote:
>I'm trying to figure out how to do a search trough a MySQL db using LIKE
>or = but the thing is that I have 3 select boxes from where to choose
>the search terms. Can I use something like a wildcard instead of making
>several IF statements like this?
>SELECT * FROM table_name WHERE col1 = value1 AND col2 = value2 AND col3
>% goes for an unselected select box (default value = %) in case the user
>doesn't want to make an *advanced* search, so it fetches all rows which
>does contains values 1 & 2.
> <mailto:[EMAIL PROTECTED]> Cesar Aracena
>CE / MCSE+I
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php