Associate
- Joined
- 27 Feb 2006
- Posts
- 1,750
- Location
- Normanton

What I want to do is when there is a row that has a stock_quantity below 10 I want it to display in red font instead of the default black.
I know what I need to do something on the lines of
if stock_quantity > 10
echo "<td><span class='style3'>" . $row["stock_quantity"] . "</span></td>" ;
else
echo "<td><span class='style2'>" . $row["stock_quantity"] . "</span></td>" ;
and I just set colour of style 3 to be red font. I just don't know how to put this into the code below so it works for each row in the while loop.
Any Advice?????????????
Cheers
$query = "SELECT * FROM stock_item ORDER BY stock_quantity ";
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
if (mysql_num_rows($result) > 0) {
echo
"<table width='97%' cellpadding='1' cellspacing='0' summary='' border='1'><tr>" .
"<th><span class='style2'>Name</span></th>" .
"<th><span class='style2'>Serail Number</span></th>" .
"<th><span class='style2'>Cost</span></th>" .
"<th><span class='style2'>Quantity</span></th>".
"<th><span class='style2'>Action</span></th></tr>" ;
while ($row = @ mysql_fetch_array($result))
{
echo "<tr>" .
"<td><span class='style2'>" . $row["stock_name"] . "</span></td>" .
"<td><span class='style2'>" . $row["stock_item_serial_number"] . "</span></td>" .
"<td><span class='style2'>" . $row["stock_item_cost"] . "</span></td>" .
"<td><span class='style2'>" . $row["stock_quantity"] . "</span></td>" .
"<td><span class='style2'><a href=".$row["stock_item_id"] .">Change/Order</a></span></td>";
"</tr>";
}
echo "\n</table>";
}
?>