我正在从 mysql 的表中显示一长串销售详细信息。问题是我只能获取一个月的数据。一旦月份更改,它不会显示任何内容。例如:从 2015 年 1 月 5 日到 2015 年 5 月 30 日显示的数据,但从 2015 年 1 月 6 日开始,它不显示任何内容。
我使用以下代码在数据库中添加每个销售的时间戳值:
$time = round(microtime(true)*1000);
其余代码在这里:
<?php
include 'connect.php';
$timestamp = "";
$return = array();
$response = "";
$sql = "SELECT * FROM receipts ORDER BY timestamp DESC LIMIT 1";
$result1 = mysqli_query($db, $sql);
if($details = mysqli_fetch_array($result1)){
$timestamp = $details['timestamp'];
}
$sql = "SELECT * FROM sales WHERE timestamp>'$timestamp' ORDER BY date ASC";
$result = mysqli_query($db, $sql);
echo "<table class=table1>";
while($fetch_options=mysqli_fetch_array($result)){
$memo=$fetch_options['memo'];
$product=$fetch_options['pid'];
$qty=$fetch_options['qty'];
$amount=$fetch_options['amt'];
echo "<tr>";
echo "<td align=center>$memo</td>
<td align=center>$product</td>
<td align=center>$qty</td>
<td align=center>$amount</td>";
echo "</tr>";
}
echo "</table>";
?>
我觉得这个问题与时间戳值有关。提前致谢。