...

View Full Version : Insert session data into mysql



garevn
05-23-2011, 09:53 PM
Into my cart i have a total value which i am trying to insert into a table.

my cart reffering $cartTotal:


$cartTotal="";..$cartTotal=number_format($pricetotal+$cartTotal,2,".","");..$cartTotal="<div align='center'>Cart Total: $".$cartTotal."</div>";

I use a session in page one

$_SESSION['cartTotal'] = $cartTotal;


In my insert page i have this:

$cartTotal=$_SESSION['cartTotal'] ;..$sql="INSERT INTO sales(address,cartTotal) VALUES('$_POST[address]','$cartTotal' )";

and i get an error

Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'center'>Cart Total: $300.00
' )' at line 2

garevn
05-23-2011, 10:11 PM
i made this and It works great now
$cartTotal="$".$cartTotal."";

the problem was the single quotes on 'center'



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum