【发布时间】:2018-03-10 17:52:09
【问题描述】:
由于某种原因,在查询数据库以获取选定范围时,以下内容未显示“未找到结果”错误消息,而是显示了表头和表尾。
$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 ...我已更新显示原点