Error with my php database code

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
zero2403
Forum Newbie
Posts: 1
Joined: Sat May 12, 2007 4:57 pm

Error with my php database code

Post 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.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Post 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.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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.
Post Reply