ashraf02 Posted April 10, 2008 Share Posted April 10, 2008 basicaly i am creating a shopping cart for my website however creating a shopping cart for one table of items is easy but can someone direct me on how to create a shopping cart that can handle more than one table of items. i really need ur help on this thanks ashraf Link to comment https://forums.phpfreaks.com/topic/100548-shopping-cart-for-multiple-tables/ Share on other sites More sharing options...
Zhadus Posted April 10, 2008 Share Posted April 10, 2008 I think you need to go into a little bit more detail in explaining what you are trying to do, perhaps an example of what you HAVE done and what needs to change or what you're trying to incorporate. Link to comment https://forums.phpfreaks.com/topic/100548-shopping-cart-for-multiple-tables/#findComment-514266 Share on other sites More sharing options...
ashraf02 Posted April 11, 2008 Author Share Posted April 11, 2008 i will post the code i have made below which works. however i want to add some more code so it can work for another table aswell. at the moment it works for my shirts table. i also want it to work for my trousers table. ashraf code <?php session_start(); $conn = mysql_connect("localhost", "root", "") or die (mysql_error()); mysql_select_db ("noble", $conn) or die (mysql_error()); if ($_POST[bas_Item_ID] != "") { $shirt_info = "SELECT Shirt_Brand FROM Shirts WHERE Shirt_ID =$_POST[bas_Item_ID]"; $shirt_info_res = mysql_query ($shirt_info) or die (mysql_error()); if (mysql_num_rows ($shirt_info_res) < 1) { header ("Location: Display_Smart.php"); exit; } else { $shirt_brand = mysql_result($shirt_info_res,0,'Shirt_Brand'); $addcart = "INSERT INTO Basket VALUES ('','$[COOKIE]PHPSESSID', '$_POST[bas_Item_ID]', '$_POST[bas_Item_Qty]', '$_POST[bas_Item_Size]', now())"; mysql_query($addcart); header("location: Showcart.php"); exit; } } else { header ("Location: Display_Smart.php"); exit; } ?> Link to comment https://forums.phpfreaks.com/topic/100548-shopping-cart-for-multiple-tables/#findComment-514570 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.