not too sure why but this query is only showing one line from the database when there are multiple items of the one clientid..
suggestions?
cheers
vamps
<?
include("header.php");
$id = $_COOKIE['username'];
?>
<table border="1" cellpadding="10" cellspacing="0" align="center"><tr><td colspan="4" align="center"><h2>CHECKOUT</h2></b></td></tr>
<td align="left"><h3>Shirt</h3></td><td align="center"><h3>Size</h3></td><td align="center"><h3>Colour</h3></td><td align="center"><h3>Quantity</h3></td></tr>
<?
// Displays the table for the current client
$sql = "select * from client_order where login = '$id'";
$result=mysql_query($sql)
or die(mysql_error());
while($row=mysql_fetch_array($result))
//start of output!
{
$ordercode = $row['ordercode'];
$qty = $row['qty'];
$shirt = substr($ordercode,0,2);
$colorcode = substr($ordercode,2,2);
$size = substr($ordercode,4,2);
//gets the order from order code
$qry = "select * from shirt where id = '$shirt'";
$result = mysql_query($qry) or die (mysql_error());
while($row=mysql_fetch_array($result))
{
$shirt = $row['name'];
}
//gets the color from order code
$qry = "select * from colour where code = '$colorcode'";
$result = mysql_query($qry) or die (mysql_error());
while($row=mysql_fetch_array($result))
{
$colorcode = $row['name'];
}
//gets the size from order code
$qry = "select * from sizes where code = '$size'";
$result = mysql_query($qry) or die (mysql_error());
while($row=mysql_fetch_array($result))
{
$size = $row['name'];
}
Print("<td align='left'>".$shirt."</td>");
Print("<td align='center'>".$size."</td>");
Print("<td align='center'>".$colorcode."</td>");
?>
<form name="blah" action="<?=$php_self?>" method="post">
<td align="center">
<?
// allows quantity to be updated
if (!isset($qty1))
{
$qty1 = $qty;
}
?>
<input name="qty1" type="text" size="1" value="<?=$qty1?>"> <input type="submit" value="update">
</td></tr></form>
<?
}
// end of inital while display query
?>
</tr></table>
<?
include("footer.php");
?>