SQL Insert - Weird Error

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


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-26-2003
Matthew Paterson
 
Posts: n/a
Default 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


Reply With Quote
  #2 (permalink)  
Old 11-26-2003
Erwin Moller
 
Posts: n/a
Default Re: SQL Insert - Weird Error

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

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 07:06 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0