473,386 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

php sql insert error - stumped!

MP
ok - I have no idea what's doing on. In a nutshell I am doing a SQL
insert in a Access database from PHP but am getting an error.

Here is the code:

// PHP db connection
$db = 'C:\\Phpweb\\govDB.mdb';
$conn = new COM('ADODB.Connection');
$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db");

and here is the error:

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

and here is a print out of the sql:
INSERT INTO Cards(active,companynam,division,streetnumb,street ,town_city,province,filetitle,air,water,sewage,ptt w,partVIII,part46,miscellany,grr,grrfile)
VALUES ('0','1 HOUR PHOTO PLUS','ob','24','RAMBLER
DRIVE','BRAMPTON','Ontario','SI HP BR RA','0','0','0','0','0','0','REG
347 - 1592500','1592500','700')

the sql works if I do a query in Access.....

please help me out...I'm losing my mind!

Thanks!
Jul 17 '05 #1
2 2353
On 12 Nov 2003 19:19:29 -0800, mp******@uoguelph.ca (MP) wrote:
and here is a print out of the sql:
INSERT INTO Cards(active,companynam,division,streetnumb,street ,town_city,province,filetitle,air,water,sewage,ptt w,partVIII,part46,miscellany,grr,grrfile)
VALUES ('0','1 HOUR PHOTO PLUS','ob','24','RAMBLER
DRIVE','BRAMPTON','Ontario','SI HP BR RA','0','0','0','0','0','0','REG
347 - 1592500','1592500','700')


Access is notoriously lenient. I don't want to cause havoc, but your
field names should really all be prepended with an indicator to the
data type (e.g. nField for numeric, cField for char/varchar). It's
just a good practice to get into.

It looks like you are setting all field values to string/character
data... are none of the fields numeric at all? Access will probably
let you get away with setting a number to a string value, but I'm
betting PHP won't.
Jul 17 '05 #2
MP
ok thanks I'll check that out...as per the names is a government
database so I can't change it...I gotta work with what I'm given :)

Thanks
Kafooey <ka*****@yahoo.co.uk> wrote in message news:<fb********************************@4ax.com>. ..
On 12 Nov 2003 19:19:29 -0800, mp******@uoguelph.ca (MP) wrote:
and here is a print out of the sql:
INSERT INTO Cards(active,companynam,division,streetnumb,street ,town_city,province,filetitle,air,water,sewage,ptt w,partVIII,part46,miscellany,grr,grrfile)
VALUES ('0','1 HOUR PHOTO PLUS','ob','24','RAMBLER
DRIVE','BRAMPTON','Ontario','SI HP BR RA','0','0','0','0','0','0','REG
347 - 1592500','1592500','700')


Access is notoriously lenient. I don't want to cause havoc, but your
field names should really all be prepended with an indicator to the
data type (e.g. nField for numeric, cField for char/varchar). It's
just a good practice to get into.

It looks like you are setting all field values to string/character
data... are none of the fields numeric at all? Access will probably
let you get away with setting a number to a string value, but I'm
betting PHP won't.

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: 73blazer | last post by:
Hello, I'm looking for a way to make some of my insert templates more readable by placing comments in between the values. I cannot seem to find a way to do this with DB2, is there a way? I'm...
6
by: efgh | last post by:
I'm fairly confident in my knowledge of SQL but I'm stumped with regards with an Insert Into statement in Access 2003. I've got a 4 column table that I've simplified about as much as I can, no...
7
by: | last post by:
I am having trouble figuring out to call a database INSERT procedure from a simple submit form. It appears I should use the onclick event to trigger the procedure called BUT when I do this I...
4
by: jsugamele | last post by:
This is my first shot at .net. This is a website and I am trying to create a comments form. Simply I want the user to hit the submit button and have the data stored into a database and a copy...
0
by: David | last post by:
Hi, I've been using MS Access as a front end to our remote MySQL db for a long time. I've just added a facility for clients to select a record to copy along with all its sub-records. The...
3
by: nolanmadson | last post by:
I'm creating a front-end for some Teradata user maintenance tables in MS Access. I've started having problems in occasionally not being able to insert or update records in these tables. I've been...
5
by: Alan Silver | last post by:
Hello, Server configuration: Windows 2003 Server SP2 SQL Server 2000 SP4 ..NET v2.0.50727 just built up a new server using the same configuration as my current one. I even used the same CDs...
5
by: xzzy | last post by:
I am writing an app that enables a user to reply to a newsgroup. The proper syntax for From: is "screen name" email@address.com and over all, it should look like: --
1
by: d-42 | last post by:
Hi, I'm trying to use FormView to Insert an Object to an ObjectDataSource. The insert method signature is simply: void DALObject.InsertPerson(Person myObject) The person object for the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.