470,849 Members | 1,133 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

SQL Insert - Weird Error

Ok - has anyone ever had this happen before?

I have a SQL Insert statement. When I build the SQL and execute it in PHP I
get the following error:

Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft
JET Database Engine Description: Syntax error in INSERT INTO statement. in
c:\phpweb\commit.php on line 81

So then I echo the SQL statement and this is what it looks like:
INSERT INTO
Cards(active,division,province,filetitle,air,water ,sewage,pttw,partVIII,part
46) VALUES ('1','ob','Ontario','0 0 0 0','0','0','0','0','0','0')

Everything is formatted correctly - column names format ect.

So then I take the echo'd sql and copy it into the PHP code as the sql
statement. When I re-run the SQL code with static sql statement it inserts
the record!!!!!

So basically if I build the SQL dynamically it won't execute. But if I echo
the dynamic sql then copy it into a sql variable it executes!

This is driving me nuts....please help!

Thanks,
Matt
Jul 17 '05 #1
1 1684
Hi Matt,

I once had the same problem with JET (ACCESS)

The reason was I used a RESERVED WORD for columnname. *sigh*
Is it possible you do the same?
Maybe active is reserved, I am not sure though..

You could check by giving all your coloumnnames an extra XXX on the end and
retry.

Good luck,
Erwin Moller

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Mike John | last post: by
2 posts views Thread by =?Utf-8?B?Y2F0?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.