This is a discussion on SQL Insert - Weird Error within the PHP Language forums, part of the PHP Programming Forums category; Ok - has anyone ever had this happen before? I have a SQL Insert statement. When I build the SQL and ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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 |