Jump to content


Photo

Multiple variable search, some empty


  • Please log in to reply
3 replies to this topic

#1 stevebob

stevebob
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 14 June 2006 - 03:32 PM

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!


#2 moberemk

moberemk
  • Members
  • PipPipPip
  • Advanced Member
  • 695 posts

Posted 14 June 2006 - 05:05 PM

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.
Disclaimer: No matter how harsh I may be, I'm always IMO only.

#3 stevebob

stevebob
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 14 June 2006 - 06:57 PM

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?

#4 moberemk

moberemk
  • Members
  • PipPipPip
  • Advanced Member
  • 695 posts

Posted 15 June 2006 - 01:46 AM

If there is, then I'm not the one to tell you. Sorry for not being able to help you with this.
Disclaimer: No matter how harsh I may be, I'm always IMO only.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users