I have an advanced search with 4 fields, only one name_first is mandatory
There are many variations of search as the other fields are not mandatory so I need a select statement that only selects the fields that have been populated, but there are so many variations
I have tried the below script but it does not show the correct information (I think it is completely wrong?!)
$name_first=$_GET["name_first"]; $status=$_GET["status"]; $type=$_GET["type"]; $manstaff=$_GET["manstaff"]; $result401=mysql_query("SELECT * FROM `hr_employees` WHERE (name_first LIKE '$name_first%') AND (status LIKE '$status%') AND (manages_staff LIKE '$manstaff%');")or die('Error' . mysql_error()); Any ideas what the script above should be? Basically if the field isnt completed it doesnt need to search for it?
$name_first%to this%$name_first%name_first IS NULL??