Hi there,
Can anyone tell me how to display the "$order_date" value once.
At the moment it is successfully displaying all values but if the $order_date is the same for an order i want it to only show once (for the top row) and any subsequent rows with the same order_date to show everything but the $order_date.
I've tried GROUP BY but this only shows one row, not any others that may exist with the same $order_date.
Here's the code:
<table width="500" border="0" cellpadding="0" cellspacing="0" class="smallText">
<tr>
<td width="100"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif"> ORDER
DATE</font></strong></td>
<td width="76"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong> ORDER
NO. </strong></font></td>
<td width="199"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong> TITLE
</strong></font></td>
<td width="75"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong> PRICE</strong></font></td>
<td width="50"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong> QTY</strong></font></td>
</tr>
<?
include ("include/dbconnect.php");
$sql = "SELECT * FROM orders WHERE customer_id = '" . $_GET['id'] . "' ORDER BY order_date DESC";
$result = mysql_query($sql);
$alternate = "2";
while($row = mysql_fetch_array($result)){
$order_id = $row["order_id"];
$movie_title = $row["movie_title"];
$movie_current_price = $row["movie_current_price"];
$qty = $row["qty"];
$order_date = $row["order_date"];
if ($alternate == "1") {
$color = "#ffffff";
$alternate = "2";
}
else {
$color = "#efefef";
$alternate = "1";
}
?>
<tr bgcolor="<? echo $color ?>">
<td height="20"> <? echo $order_date ?></td>
<td> <? echo $order_id ?></td>
<td> <? echo $movie_title ?></td>
<td> <? echo $movie_current_price ?></td>
<td> <? echo $qty ?></td>
</tr>
<?
}
?>
</table>
Cheers,
chrima