有没有办法让我不必在每个条件下编写完整查询?
if($_GET['l'] == 1){
$num = $db -> query("SELECT * FROM text WHERE type = '' AND gg = '1'") -> num_rows;
}
elseif($_GET['l'] == 2){
$num = $db -> query("SELECT * FROM text WHERE type = '' AND gg = '2'") -> num_rows;
}
else {
$num = $db -> query("SELECT * FROM text WHERE type = ''") -> num_rows;
}
凤凰求蛊