Search all MySQL columns from dropdown list

Hi everyone,

I have a combobox/dropdown list which lets the user select certain criteria to search a database. I have defined the variables as follows:

[php]$artist =$_POST[‘artist’];[/php]

However I’d like to also be able to search all items within a column if a user leaves the selection to “All” or default. I have searched quite a bit but cannot find any examples on how to do this.

I thought I could possibly create an “if statement” to let the variable equal “*” should the posted value equal “All”. Please excuse the code:

[php]$artist =$_POST[‘artist’];
if ($_POST[‘artist’]==“All”) then ($artist=="*");[/php]

Any advice on if this could in fact be done would be much appreciated!

Sponsor our Newsletter | Privacy Policy | Terms of Service