-1

$country$job_type来自下拉列表

if ($country == 'All' && $job_type == 'All') {
    $data = mysql_query("SELECT * FROM cv ")
}else {
    $data = mysql_query("SELECT * FROM cv WHERE country='$country' AND job='$job_type'")      
}
4

1 回答 1

4

你似乎错过了一些;,试试这个:

if ($country == 'All' && $job_type == 'All') 
{
  $data = mysql_query("SELECT * FROM cv WHERE country='$country' AND job='$job_type'");
} else {
  $data = mysql_query("SELECT * FROM cv");
}

本杰明有一点,你的 IF 逻辑似乎不正确。也许你想要这个?

if ($country == 'All' && $job_type == 'All') 
{
  $data = mysql_query("SELECT * FROM cv");
} else {
  $data = mysql_query("SELECT * FROM cv WHERE country='$country' AND job='$job_type'");
}
于 2013-01-14T08:34:03.693 回答