I need to output the result from an SQL query as a table for each date. Each date has several rows with a uniqe id, a system name and a remark.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$dbname") or die("cannot select DB");
$query = "
SELECT id, Date, System, Remark FROM records WHERE Date BETWEEN '$from' AND '$to'
ORDER BY Date, CASE System
WHEN 'System1' THEN 1
WHEN 'System2' THEN 2
WHEN 'System4' THEN 3
WHEN 'System5' THEN 4
ELSE 19
END
";
$result = mysql_query($query);
How do I proceed from this to generate a table that contains all rows with the same date:
<table>
<tr><th colspan="3"> Display date here</th></tr>
<tr>
<td>Display System here</td>
<td>Display Remark here</td>
<td>Display id here</td>
</tr>
<tr>
<td>Display System here</td>
<td>Display Remark here</td>
<td>Display id here</td>
</tr>
<tr>
<td>Display System here</td>
<td>Display Remark here</td>
<td>Display id here</td>
</tr>
</table>