如何讓PHP顯示一條消息,指出它找不到任何結果,而不是在查詢找不到任何結果時顯示任何結果結果如何?如何顯示找不到任何結果的錯誤消息
這裏是我的代碼結果的顯示:
print " <table border = '1'> \n";
print " <tr> \n";
while ($field = mysqli_fetch_field($result)){
print " <th>$field->name</th> \n";
} // end while
print " </tr> \n";
while ($row = mysqli_fetch_assoc($result)){
print " <tr> \n";
foreach ($row as $name => $value){
print " <td>$value</td> \n";
} // end foreach
print " </tr> \n";
} // end while loop
print " </table> \n";
http://php.net/manual/en/mysqli-result.num-rows.php – CBroe 2014-10-01 13:42:38