RE: (newbie) Multi filter table
| From: | Bobby Rahman | Date: | Mon, 21 Apr 2003 01:13:31 +0000 |
| Subject: | RE: (newbie) Multi filter table | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-144581@lists.php.net to get a copy of this message | ||
Hiya
I am sure that a few weeks a go I saw a thread regarding building a dynamic sql query. I have had a quick poke in the archives but cant locate it.
Does anyone know how I can find out of filtering a table by using more than one filter selected from drop down boxes.
e.g
Table consists of all users
SELECT * FROM users
Filter selected from drop down box called Sex= Female
I want the mysql to change to:
SELECT * FROM users WHERE sex = Female
Now say 2 filters are selected
Sex= Female and work=Part-time
I want the query to build to
SELECT * FROM users WHERE sex=female and work=Part-time
I think it can be done using a counter to add the equivalent WHERE and AND within query ...depending on the number of filters.
Has anyone got a snippet of code that may help me, or point me to a tutorial/thread that I saw a few weeks ago.
Thanx
Bobby
_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger