Shopping Cart problem
Posted: Tue Jun 24, 2008 6:24 pm
I have done insert , delete part of shopping cart. All works fine , but I have two problems
1. When I refresh why all data is lost?
2. As you can see in the right part , if you refresh, it shows data from cart table but no delete image right side.
and if you add same product in same session, still it comes in separate row.
http://shoppingsurat.com/cart/basket.php
Please check my code
<table id="shopping_cart_items" border='1' width="250">
<tr>
<th>Items</th>
<th>Description</th>
<th>Price</th>
</tr>
<?
$sel_cart="select * from cart where sess='".$_SESSION['sess']."' group by prod_name";
$qry=mysql_query($sel_cart);
while($rs=mysql_fetch_array($qry)){
$cnt=mysql_num_rows($qry);
?>
<tr id="shopping_cart_items_product<?=$rs['cart_id']?>">
<th><?=$rs['qty']?></th>
<th><?=$rs['prod_name']?></th>
<th><?=$rs['price']?></th>
<th></th>
</tr>
<?
}
?>
<!-- Here, you can output existing basket items from your database
One row for each item. The id of the TR tag should be shopping_cart_items_product + productId,
example: shopping_cart_items_product1 for the id 1 -->
</table>
<div id="shopping_cart_totalprice"></div>
I have no idea where I am wrong. Please help!
Thanks