By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,510 Members | 1,810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,510 IT Pros & Developers. It's quick & easy.

SQL Insert - Weird Error

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.