Session destroy not working
Posted: Thu Oct 11, 2007 7:11 am
feyd | Please use
I use this code to avoide duble insertation but is not working please any help
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]Code: Select all
session_start();
$CartID1= "1";
$_SESSION['cartid']=$CartID1;
$_SESSION['quantity']="1";
$_SESSION['productid']=$_GET['var'];
$_SESSION['productname']=$_GET['var2'];
$_SESSION['price']=$_GET['var2'];
$productid=$_SESSION['productid'];
$cartid=$_SESSION['cartid'];
$productname=$_SESSION['productname'];
$price=$_SESSION['price'];
$quantity=$_SESSION['quantity'];
//$_SESSION['cartid'];
//$_SESSION['cartid'];
echo $price;
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("manvisdatabse", $con);
$query = mysql_query("INSERT INTO cart (CartID,ProductID,ProductName,Price, Quantity, TotalPrice) VALUES ('$cartid',
'$productid', '$productname', '$price', '$quantity', '$price')ON DUPLICATE KEY UPDATE Quantity=Quantity+'$quantity', TotalPrice=Price*Quantity");
if(!$query)
{
echo"Query Lesh";
}
session_unset();
mysql_close($con);I use this code to avoide duble insertation but is not working please any help
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]