In mysql I have unix epoch time inserted and it needs to be displayed in calendar like table. Every timedate should be echoed in row that represents that day.
Code that I have is this and it echoes 31 days in one column and all timestamps in one row. How to put them in correct day/row? Thank you.
<table>
<tr>
<td><strong>day</strong></td>
<td><strong>timestamp</strong></td>
</tr>
<?php
$sel = "select time from rv where id=$id";
$rez = mysql_query($sel) or die(mysql_error());
$n = mysql_num_rows($rez);
for($day=1; $day<32; $day++){
echo "<tr>";
echo "<td>$day.</td>";
while ($re = mysql_fetch_array($rez)){
$time_b = $re["time"];
$time_a = new DateTime("@$time_b");
echo "<td>";
echo $time_a->format('h:i:s');
echo "</td>";
}
echo "</tr>";
}
?>
</table>
Update: Here is what I get now. And I need every date to be displayed in correct day/row http://s3.postimg.org/nvmlf1mtv/test.jpg