$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'")
}
答案 0 :(得分: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'");
}