Author Topic: Search all MySQL columns from dropdown list  (Read 76 times)

JoeSyn

  • New Member
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Search all MySQL columns from dropdown list
« on: January 26, 2012, 07:12:56 AM »
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 Code: [Select]
$artist =$_POST['artist'];

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 Code: [Select]
$artist =$_POST['artist'];
if (
$_POST['artist']=="All"then ($artist=="*");


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