Page 1 of 1

Error with my php database code

Posted: Sat May 12, 2007 5:03 pm
by zero2403
$conn->Execute("Insert Into User_Items
Values(".$Cart->Fields['Cart_Item_ID']->Value.",'".$groupD->Fields['Group_Name']->Value."','".$cdD->Fields['Cd_Title']->Value."', ".$cdD->Fields['Cd_Price']->Value.", ".$qty2.", ".$cdD->Fields['Cd_Special']->Value.")");


Its telling me i have a syntax errors if anyone has any idea whats wrong or any pointers on how i could fix it it would be appreciated.

Posted: Sun May 13, 2007 8:38 pm
by aceconcepts
I've noticed you have used double quotes " with single quotes ' but only in some of the values.

Not quite sure, but maybe you should run some alternative tests.

Just try using single quotes.

Posted: Sun May 13, 2007 8:55 pm
by volka
Please try

Code: Select all

$query = "Insert Into
		User_Items
	Values(
		".$Cart->Fields['Cart_Item_ID']->Value.",
		'".$groupD->Fields['Group_Name']->Value."',
		'".$cdD->Fields['Cd_Title']->Value."',
		".$cdD->Fields['Cd_Price']->Value.",
		".$qty2.",
		".$cdD->Fields['Cd_Special']->Value."
	)";
echo '<div>Debug: ', htmlentities($query), "</div>\n";
$conn->Execute($query);
and post the output.