Page 1 of 1

SQL Syntax error

Posted: Sun Dec 11, 2005 9:10 am
by janey
i keep getting this error message:
Fatal error: Uncaught exception 'com_exception' with message 'Source: Microsoft JET Database Engine
Description: Syntax error in INSERT INTO statement.' in c:\Inetpub\wwwroot\Assignment\orderconf.php:59 Stack trace: #0 c:\Inetpub\wwwroot\Assignment\orderconf.php(59): com->Execute('INSERT INTO T_o...') #1 {main} thrown in c:\Inetpub\wwwroot\Assignment\orderconf.php on line 59
this is the code to it:

Code: Select all

$adoCon->Execute
	("INSERT INTO T_order(SesId, Harrier, SixNut, Mount, Nut, Seal312a, Tracking, Wing, Turbine, Injection, Seal, UserId) VALUES ('$Session', $Harrier, $SixNut, $Mount, $Nut, $Seal312, $Track, $Wing, $Turb, $Injection, $Seal, '$User');");
can anyone help?

Posted: Sun Dec 11, 2005 10:57 am
by shiznatix
one thing i see of the bat is you only put the quotes around $Session and not any of the other values.

Posted: Sun Dec 11, 2005 11:31 am
by janey
shiznatix wrote:one thing i see of the bat is you only put the quotes around $Session and not any of the other values.
the others are numbers so they shouldnt need the quotes?

ive tested it in access and it works but it wont work if you enter it via php?

Posted: Sun Dec 11, 2005 3:14 pm
by AKA Panama Jack
Try dropping the ; in the query (yes that can mess it up in php even though you can use it command line).

Posted: Mon Dec 12, 2005 10:11 am
by janey
ive just solved it... i needed to set a default value of 0 and not "" as their number fields!

Thanks for your help everyone!