Jump to content

Shopping cart for multiple tables


ashraf02

Recommended Posts

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;
}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.