How would I display rows that have a timestamp value within the last hour?
Here is what I have right now, and it is showing the latest rows, and only 3 rows because of the LIMIT.
$query5= mysql_query("SELECT * FROM `made_orders` ORDER by id DESC LIMIT 0,3");
WHILE($datarows5 = mysql_fetch_array($query5)):
$name4 = $datarows5['Name'];
$phone4 = $datarows5['Phone'];
$entree4 = $datarows5['Entree'];
$side14 = $datarows5['Side 1'];
$side24 = $datarows5['Side 2'];
$drink4 = $datarows5['Drink'];
$totalcost4 = $datarows5['Total Cost'];
$ip4 = $datarows5['Ip'];
$id4 = $datarows5['id'];
$time4 = $datarows5['timestamp'];
echo "<iframe src=\"creatmeal-data.php?id={$id4}\" width=\"430px\" style=\"border:0px\" height=\"350px\"/></iframe>";
endwhile; ?>
In my above code, each time a row is found, it echos an iframe. How would I edit the query to use my timestamp column to show only the latest within an hour.
Thanks in advance for your help!
EDIT: Here is what my timestamp column looks like: http://img856.imageshack.us/img856/4135/columnk.png
Your current query gets the three most recent orders regardless of whether or not they were created in the last hour.
Use this solution:
This would get at most three orders within the last hour. If there was only one order within the last hour, it would only select one row.