Hi,
The code currently displays database out put in this format.
GroupName : Flower
rose
petal
GroupName : Animal
goat
cow
I would like to display a field group result at the end of each group.
Thus:
GroupName : Flower
rose
petal
Results
GroupName : Animal
goat
cow
Results
How can I do this? Its just a display thing.
$sql ="SELECT DISTINCT $dbtable.serial_value,$dbtable.type,$$dbtable.group_id,$dbtable.results,table.name,$table.nr,$table.normals,$table.msr_unit FROM $dbtable INNER JOIN $table ON $dbtable.group_id = $table.group_id WHERE $dbtable.job_id = '$batch_nr' ORDER BY group_id DESC";
$res = mysql_query($sql) or die(mysql_error());
while ($rows = mysql_fetch_assoc($res)){
if ($rows['group_id'] != $lastgroup) {
// Print Group Name
echo "<tr>
<td colspan=3 align=left><strong>GroupName: ".$rows['group_id']."</strong></td>
</tr>\n";
}
echo "<tr>
<td width=50> </td>
<td width=200 height=25 align=center>".$rows['name']."</td><tr>";
$lastgroup = $rows['group_id'];
}