Jump to content

Archived

This topic is now archived and is closed to further replies.

stevebob

Multiple variable search, some empty

Recommended Posts

I have a database drivensite and need to add an 'advanced search' function to it. The code below seems to work, but only if I have selected a value for each of the variables. If any are left empty then the results page shows no results. Is there a way to have the results show even if one variable has had no value. I have tried using for example and 'all genres' option on the search with a value of '0' or '-1' but this does not seem to work.

SELECT *
FROM performers
WHERE gender = 'colname' AND genre LIKE '%colgenre%' AND voicetype LIKE '%colvoice'
ORDER BY name ASC


Also, I am using drop-down lists at the moment. How can I set up the search to use multiple checkboxes for 'genre' and search for ANY of the selected - e.g. if you tick 'documentary' and 'corporate' it will look for both of those values in the 'genre' column, as well as the other variables.

Hope you can help. I am new to database driven sites and this project has snowballed!

Share this post


Link to post
Share on other sites
Since you're posting in the Dreamweaver section, I'll assume that you are using Dreamweaver. If you are open to buying an extension, there is always the [a href=\"http://www.interaktonline.com/\" target=\"_blank\"]interAKT[/a] Site Search extension you could use.

Share this post


Link to post
Share on other sites
Thanks.
Does the extensiion work for only searches where you type in the variables? Or can it be configured for drop-down menus / checkboxes?

Is there a way to do this without shelling out for an extenstion?

Share this post


Link to post
Share on other sites
If there is, then I'm not the one to tell you. Sorry for not being able to help you with this.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.