下面是我的代码。$data 是查询的结果,我希望 PHP 在没有返回结果时实现并显示回显“没有匹配的结果...”如果数据库确实返回结果,则回显表。当没有返回结果时,以下没有意识到......
if ($data == null) {
echo "<strong>There were no Matching Results...Please Return to the '<a href='section_search.php'>Section Search Page</a>'</strong></br></br></br>";
}
else {
echo "<table border=0 cellpadding=10>";
echo "<tr align = center bgcolor=white>
<td><b>Company</b></td><td><b>Section</b></td><td><b>Question</b></td><td><b>Answer</b></td>" ;
while($info = mysql_fetch_array( $data ))
{
echo "<tr>";
echo "<td width = 60px><b>".boldText($info['company_name'], $kword) . "</b></td> ";
echo "<td width = 60px><b>".boldText($info['section_name'], $kword) . "</b></td> ";
echo "<td width = 360px>".boldText($info['question'], $kword) . " </td>";
echo "<td width = 600px>".boldText($info['answer'], $kword) . " </td></tr>";
}
echo "</table>";
}
}
任何帮助都会很棒!
谢谢