任何显示用户消息的建议,以避免大量if / else语句。
if($row->num_rows > 1) {
ok
} else {
print "There is no...";
}
谢谢!
答案 0 :(得分:1)
$err = array();
if(!$row->num_rows > 1) {
$err[]= "There is no...";
}
...
if (!$err) {
//ok. doing stuff
} else {
foreach ($err as $message) {
echo $message."<br>\n";
}
}