PDA

View Full Version : need help with Parse error


mr_badger
06-12-2009, 12:24 PM
Hi,
Iam getting this parse error - Parse error: parse error, expecting `','' or `')''

This is the code:

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
if(isset($_SESSION['cartGuid'] && $_SESSION['cartGuid'] != '') {
$cartGuid = $_SESSION['cartGuid'];
} else {
$cartGuid = md5(uniqid(rand(), true));
$_SESSION['cartGuid'] = $cartGuid;
}
$insertSQL = sprintf("INSERT INTO cart (product_id, product_quantity, cartGuid) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['id'], "int"),
GetSQLValueString($_POST['quantity'], "int"),
GetSQLValueString($cartGuid, "text"));


I can't figure out what's doing this, please help me.

edbr
06-13-2009, 02:01 AM
$insertSQL = sprintf("INSERT INTO cart (product_id, product_quantity, cartGuid) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['id'], "int"),
GetSQLValueString($_POST['quantity'], "int"),
GetSQLValueString($cartGuid, "text"));

"INSERT has no closing " try
$insertSQL = sprintf("INSERT INTO cart (product_id, product_quantity, cartGuid) VALUES (%s, %s, %s)")

mr_badger
06-13-2009, 06:49 PM
no, that hasn't solved the problem, still the same parse error message.

knight13
06-15-2009, 08:31 AM
I am not positive but do you need to add a } to the end of the code?

mr_badger
06-15-2009, 10:55 AM
it's been solved, this is the right bit of code that solved it. if(isset($_SESSION['cartGuid']) I missed putting the bracket.