just for fun here is an old one of mine
<?
session_start();
session_register('ip');
$pid=$PHPSESSID;
require("commonmn.php");
require("dbconng.php");
HTMLHeader();
function no_item(){
if (!$PHPSESSID){
echo "<div style=\"position:absolute; top:250px; left:300px;\"><h2><font color=\"red\">
You have no items in your cart!</font></h2></div>";
} }
// echo "ip=$ip...PID=$PHPSESSID";
echo "<table><th>Product</th><th>Color(s)</th><th>Option(s)</th><th>Quantity</th>
<th>Total Price</th>";
$x=1; //counter to switch row color
//mysql_pconnect($conn);
//SQL to hit DB and generate order list
$SQLGetOrder = "select prod_id, baseColor, bodyColor, options_ordered, quantity_ordered
from gulf_orders where session_id='$pid'";
//execute the query to get the orders
$SQLOrders = mysql_query($SQLGetOrder) or die ("Couldn't execute query");
//get the order info to query the product details and the options
while ($roworder = mysql_fetch_array($SQLOrders,$conn)){
$ProdID = $roworder["prod_id"];
$PBase = $roworder["baseColor"];
$PBody = $roworder["bodyColor"];
$POpts = $roworder["options_ordered"];
$PQ = $roworder["quantity_ordered"];
if ($POpts =="Array"){$POpts="";}
//get the product info for each product ordered
$SQLProds = "select * from gulf_products where prod_id = $ProdID";
//echo $SQLProds;
//execute the product query to get the items details
$SQLGetProd = mysql_query($SQLProds,$conn) or die ("Couldn't execute product query");
while ($rowprod = mysql_fetch_array($SQLGetProd)){
$PName = $rowprod["prod_name"];
$PPrice = $rowprod["prod_price"];
$PTPic = $rowprod["gulf_thumb_pic"];
$PBaseC= $rowprod["prod_base_color"];
$PBodyC = $rowprod["prod_body_color"];
$POptsAvail = $rowprod["prod_options"];
$PType = $rowprod["prod_type"];
if ($x==1){
echo "<tr bgcolor=\"silver\">";
$x=0;
}else{
echo "<tr bgcolor=\"cadetblue\">";
$x=1;
}
echo "<td width = 150>$PName $PType</td><td width = 150>
<table><tr><td width=\"150\">Base Color: $PBase</td></tr>
<tr><td width=\"150\">Body Color: $PBody</td></tr></table></td>
<td width = 175>";
if (($POpts)||($POpts<>"")){
//get the option details
$SQLOptions = "select * from gulf_options where option_id in ($POpts);";
//echo $SQLOptions;
//execute the options query based on details in the order options field
$SQLGetOpts = mysql_query($SQLOptions,$conn) or die ("Couldn't query options data");
while ($rowopts = mysql_fetch_array($SQLGetOpts)){
$POptName = $rowopts["option_name"];
$POptPrice = $rowopts["option_price"];
$TtlOptPrice = $TtlOptPrice + $PQ*$POptPrice;
echo "<table><tr><td width = 175>$POptName</td></tr>";
}
}else{
echo "<table><tr><td width = 100>N/A</td></tr>";
}
$PTotal = $PQ*$PPrice+$TtlOptPrice;
$PNetOrder=$PTotal+$PNetOrder;
echo "</table></td><td width = 75 align=\"center\">$PQ</td><td width = 100 align=\"center\"><b>$$PTotal</b></td></tr>";
}
}
echo "<tr><td colspan=4><b>Total</b> </td><td align=\"center\"><b>$$PNetOrder</b></td></tr></table>";
echo "<p>Please note the total does not include shipping, applicable taxes and discounts.";
HTMLFooter();
?>