I have a PHP code which pulls out the pc status field from a database, and displays a Green square if its working, Amber if its awaiting attention and Red if its faulty.
The code at the minute displays 1 square below another - in separate table rows it appears. Is there any way of changing the layout so it presents the images in rows of 5 columns.
i.e.
R R R R R
G G R R G
A A A A A
etc. (R = Red, A = Amber, G = Green images).
Thanks.
The code at the minute displays 1 square below another - in separate table rows it appears. Is there any way of changing the layout so it presents the images in rows of 5 columns.
i.e.
R R R R R
G G R R G
A A A A A
etc. (R = Red, A = Amber, G = Green images).
Thanks.
Code:
<table>
<tr><th>Colour</th></tr>
<?php
$workstations = @mysql_query($select . $from . $where);
if (!$workstations) {
echo '</table>';
exit('<p>Error retrieving workstation data from database!<br />'.
'Error: ' . mysql_error() . '</p>');
}
while ($computer = mysql_fetch_array($workstations)) {
echo "<tr valign='top'>\n";
$status = htmlspecialchars($computer['status']);
if ($status=="WORKING") {
echo "<td align=center><img src='green.jpg'></td>";
}
if ($status=="ATTENTION") {
echo "<td align=center><img src='amber.jpg'></td>";
}
if ($status=="FAULTY") {
echo "<td align=center><img src='red.jpg'></td>";
}
}
?>
</table>