This is a function which displays a graph of values in a table. My problem is that it only makes space where there actually is a value, I need it to make space where there is no value as well.
This is how it does it now:
$auc_sql table:
bid---------count
1------------2
3------------1
7------------1
8------------1
9------------2
Output:
| |
| | | | |
1 3 7 8 9
I want it to be like this:
|--------------|
|---|------|-|-|
1 2 3 4 5 6 7 8 9
The solution is maybe to use some kind of for loop along with the while loop?
for ( $counter = 0; $counter <= 9; $counter++)
Please help!
Current code:
$auc_sql = "SELECT bid, COUNT(*) AS count FROM bids WHERE auction='number1' GROUP BY bid ORDER BY bid";
$auc_query = mysql_query($auc_sql) or die(mysql_error() . "<br>" . $auc_sql);
echo "<b>Graph</b><table cellspacing='1' cellpadding='0' class='table'><tr valign='bottom'>";
while ($auc_row = mysql_fetch_assoc($auc_query)) {
echo "<td><img src='bar.jpg' width='5' height='".$auc_row["count"]."'><br>".$auc_row["bid"]."</td>";
}
echo "</tr></table>";