I generate a list from the data in my sql database. The problem is that the list prints the "System" name before each remark instead of listing the "Remark" for all rows containing the same "System" name under one .
Code:
<?php
require("dbcon.php");
$query = "
SELECT
id,
Date,
System,
Remark
FROM records
WHERE Date BETWEEN '$from' AND '$to'
ORDER BY Date
";
echo "<div id='heading'>EVENT LOG: Last week</div><br />";
$result = mysql_query($query);
while ($row=mysql_fetch_array($result)) { ?>
<ul><?php echo $row["System"]; ?>
<li><?php echo $row["Remark"]; ?></li></ul>
<?php } ?>
This gives me a output like:
Systemname1
- Log entry for Systemname 1 (stored under Remark in database)
Systemname1
- Log entry for Systemname 1
Systemname2
- Log entry for Systemname 2
Systemname2
- Log entry for Systemname 2
But what I want is:
Systemname1
- Log entry for Systemname 1
- Log entry for Systemname 1
Systemname2
- Log entry for Systemname 2
- Log entry for Systemname 2
This can probably be fixed in some way by using foreach(), but I'm not sure how :/