Create Table with AutoIncrement-field in M$ AccessDB

From: Date: Tue, 22 Oct 2002 09:58:52 +0000
Subject: Create Table with AutoIncrement-field in M$ AccessDB
Groups: php.db 
Request: Send a blank email to php-db+get-22570@lists.php.net to get a copy of this message
I try to make a new table using PHP4 & M$ Access (via ADODB). This is the code I use: //begin DB-connection to create table $db_connection = new COM("ADODB.Connection"); $db_connstr = "driver={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("database.mdb") ." ;DefaultDir=". realpath(""); $db_connection->open($db_connstr); $table = "CREATE TABLE $pad (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
                             name TEXT(30),
                             email TEXT(30),
                             http TEXT(30),
                             icq TEXT(15),
                             message MEMO,
                             adddate TEXT(15),
                             ip TEXT(15),
                             location TEXT(35),
                             browser TEXT(55),
                             comment TEXT(255),
                             rating INT NOT NULL
                             )";
$result = $db_connection->execute($table); $db_connection->Close(); //end DB-connection to create table when I delete the "AUTO_INCREMENT"-part, the table is created properly, exept for the fact that the 'id' is NOT autoincrement. Does anyone have a solution (or workaround) Tnanx Aikie

« previous php.db (#22570) next »