Page 1 of 1

Create table on .mdb access database with odbc system-dsn

Posted: Tue Mar 02, 2004 4:28 pm
by phreud
Hey,

I have a problem and can't find any info online on how to do it. I'm trying to create a table in an access database connected with odbc system-dsn located on a web hotel. I think they are using IIS.

This is what I've tried:

Code: Select all

$res=ODBC_EXEC($connection,"CREATE TABLE forum2 (
					id int NOT NULL auto_increment ,
					par_id int NOT NULL ,
					poster varchar(50) ,
					message varchar(1000) ,
					mess_date date ,
					PRIMARY KEY (id))
				");
This produces an error, the following:
Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error in CREATE TABLE statement., SQL state 37000 in SQLExecDirect in E:\epec\www\wsp\test.php on line 23
Line 23 is the line above. The odbc connection works fine, and I can even create a tableif I use for example:


Code: Select all

$res=ODBC_EXEC($connection,"Create table forum(mess_id int,par_id int,name varchar,message varchar,mess_date date)");
Don't mind the different var names, I'm just too lazy to change them to match the first code :)

It seems there is a problem whenever I give more arguments to the data type? Any help would be greatly apprechiated. Keep in mind I dont have access to the .mdb file, so I have to create this table from a php script.

/ phreud