ayok Posted December 28, 2007 Share Posted December 28, 2007 Hi, I'm trying to make a simple online shop where we can add the products to a shopping cart. So, the visitors choose the products and can view the product on a basket. The table will show the quality, name and total price. The problem is I got 2 extra rows with 2 qualities, 0 price and no product, above the selected products rows. I can't delete those either. This is the basket.php script: <?php include "functions_cart.php"; $totalvalue = 0; session_start(); if (!isset($_SESSION["cart"])) { $_SESSION["cart"] = NULL; } if (validate() == TRUE && $_SESSION["cart"] != NULL) { foreach ($_SESSION["cart"] as $key => $session_data) { list($ses_id, $ses_quan) = $session_data; db_connect(); $sel_products = mysql_query("SELECT * FROM $mysql_tablename WHERE prod_id=".$ses_id.""); $item = mysql_fetch_array($sel_products); $totalvalue = $totalvalue + ($item["price"]*$ses_quan); $subtotal = ($item["price"]*$ses_quan); ?> <tr> <td><a href="<?php echo "phpCart_manage.php?act=del&pid=".$ses_id; ?>">delete</a></td> <td><input name="newquan[]" type="text" id="newquan[]3" value="<?php echo $ses_quan; ?>" size="5" maxlength="4"> <input name="eid[]" type="hidden" id="eid[]" value="<?php echo $ses_id; ?>"></td> <td><?php echo $item["title"]; ?></td> <td><?php echo $cur_symbol."".number_format($item["price"], 2, '.', ''); ?></td> <td><?php echo $cur_symbol."".number_format($subtotal, 2, '.', ''); ?></td> </tr> <?php } } elseif ($_SESSION["cart"] == NULL) { echo "<td colspan=\"5\"><center><p>Your basket is currently empty.</p></center></td>"; } else { echo "<td colspan=\"5\"><center><p>Unknown Error.</p></center></td>"; } ?> Would anyone see what's possibly wrong? Thank you, ayok Quote Link to comment https://forums.phpfreaks.com/topic/83507-solved-extra-rows/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.