由於某種原因,當查詢數據庫的選定範圍時,下面沒有顯示「找不到結果」錯誤消息,但正在顯示錶頭和頁腳。當沒有找到記錄時不顯示消息
$result = mysqli_query($con,"SELECT * FROM tblRecords WHERE DATE(RecDate) = CURDATE() - INTERVAL 1 DAY ORDER BY RecDate DESC, RecTime DESC");
<?php
if (!$result) { echo("No results found for the selected view");
} else ?>
<table id="results">
<tr>
<th>Rec#</th>
<th>Date</th>
<th>Time</th>
<th>Reading</th>
</tr>
<?php ;
while($row = mysqli_fetch_array($result))
?>
<tr>
<td><?php echo($row['RecID']);?></td>
<td><?php echo(date("d/m/Y", strtotime($row['RecDate'])));?></td>
<td><?php echo(date("g:i A", strtotime($row['RecTime'])));?></td>
<td><?php echo($row['RecReading'] . $row['RecMeasure']);?></td>
</tr>
<?php
}
?>
<tr>
<td class="footer" colspan="4">- end of report -</td></tr>
</table>
<?php
mysqli_close($con);
?>
任何援助將不勝感激理論上,這應該工作......不應該嗎? :-)
它可能會有所幫助看看你是如何創建'$ result' –
True @PatrickQ ...我已更新顯示原點 – cloudseeker