如何让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