I am displaying a long list of sales details from a table in mysql. The problem is I am being able to fetch data only for a month. As soon as the month changes it doesnt display anything. For ex: data being displayed from 1/05/2015 to 30/05/2015 but from 1/06/2015 it does not display anything.
I add the timestamp values on each sale in the database using the following code:
$time = round(microtime(true)*1000);
Rest of the code is here:
<?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>";
?>
I feel this problem is something to do with the timestamp values. Thanks in advance.