"; $stuff = sybase_query("select * from cart WHERE custid = \"$custid\" AND itemid = \"$additem\"", $connection); $row = sybase_fetch_array($stuff); if ($row) { /* adding more than one of an item */ $num = $row["quan"] + 1; sybase_query("update cart SET quan=$num WHERE custid = \"$custid\" AND itemid = \"$additem\"", $connection); } else { sybase_query("INSERT into cart VALUES (\"$custid\", \"$additem\", 1)", $connection); } } if ($delete) { sybase_query("DELETE from cart WHERE itemid = \"$delete\"", $connection); } $allitems = sybase_query("SELECT trainitems.itemid, productname, price, quan FROM trainitems, cart WHERE cart.custid = \"$custid\" AND cart.itemid = trainitems.itemid"); if (sybase_num_rows($allitems) != 0) { $total = 0; print "
ID | Product | "; print "Price | "; print "# | "; print "Subtotal | "; print "|
---|---|---|---|---|---|
$row[itemid] | "; print "$row[productname] | "; print "\$$row[price] | "; print "$row[quan] | "; print "\$" . $row[quan]*$row[price]. " | "; print "Remove |
Total: | "; print "\$$total |
"; } sybase_close($connection); ?>