[SOLVED] Generate Table Using Loop
Posted: Wed Oct 13, 2010 1:53 am
Hi Im having trouble with this code
Im trying to get this output.
10 - 13 -2010
1 | Paper | Paper Maker
2 | Ink | Ink Maker
10 - 14 - 2010
3 | Chair | Chair Maker
Code: Select all
$get = mysql_query("
SELECT requestdate, itemname, businessname, itemid
FROM tempoq t
LEFT JOIN customerinfo c
ON t.customerid = c.customerid
ORDER BY requestdate
") or die (mysql_error());
while ($row = mysql_fetch_assoc($get))
{
if ($row['requestdate'] != $currentDate)
{
echo "<table class=listing cellpadding=0 cellspacing=0 border=0>";
echo "<tr>";
echo "<th>".$row['requestdate']."</th>";
echo "</tr>";
$currentDate = $row['date'];
}
echo "<tr>";
echo "<td>" .$row['itemid']. "</td>";
echo '<td><a href = "quoteitem?label='.$row['itemid'].'">'.$row['itemname']."</a></td>";
echo "<td>" .$row['businessname']."</td>";
echo "</tr>";
echo "</table>";
}
Im trying to get this output.
10 - 13 -2010
1 | Paper | Paper Maker
2 | Ink | Ink Maker
10 - 14 - 2010
3 | Chair | Chair Maker