I have 2 drop-down menu to search mysql based on department and section. The value of dd menu taken from enumeration.
This is my search code.
$dept_array = enum_options(\'department\', $link_id);
$sect_array = enum_options(\'section\', $link_id);
...
$query = \"SELECT * FROM user WHERE \";
for($counter=0; $counter < count($dept_array); $counter++)
{
for($counter=0; $counter < count($sect_array); $counter++)
{
if($depart == $dept_array[$counter] || $sect == $sect_array[$counter2])
{
$query .= \" department LIKE \'%$depart\' OR section LIKE \'%$sect\' ORDER BY designation ASC\";
}}}
The problem is the search will only return a result when i search the first value in both dd menu.
Please help.