I basically just want a specific list to be displayed depending on the office type and location chosen from a dropdown list. Only now the listing that is displayed does not seem to coinside with the
selected choices from the drop-down. eg. if choosing a chiropractor from toronto, i get an optometrist showing up in the list! I checked the switch code and it seems to be correct!? help please!
Code: Select all
--database statements--
$db = mysql_select_db($database,$connection)
or die ("Couldn't select database");
if ($city=="-Any City-" && $industry=="-Any Discipline-") {
$i==0;
}
elseif ($city!="-Any City-" && $industry!="-Any Discipline-") {
$i==1;
}
elseif ($city=="-Any City-" && $industry!="-Any Discipline-") {
$i==2;
}
elseif($industry=="-Any Discipline-" && $city !="-Any City-") {
$i==3;
}
switch ($i) {
case 0:
$query = "SELECT * FROM Proffesional_list";
break;
case 1:
$query = "SELECT * FROM Proffesional_list WHERE industry='$industry' AND city='$city'";
break;
case 2:
$query = "SELECT * FROM Proffesional_list WHERE industry='$industry'";
break;
case 3:
$query = "SELECT * FROM Proffesional_list WHERE city='$city'";
break;
}
$result= mysql_query($query)
or DIE("unable to retrieve database info");
--echo statements pas here--