Re: Create Table with AutoIncrement-field in M$ AccessDB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



AUTO_INCREMENT is for MySQL. Access uses a column type called auto_number or
something, I think.

---John Holmes...

----- Original Message -----
From: "Jaap Aikema" <jaapaikema@hotmail.com>
To: <php-db@lists.php.net>
Sent: Tuesday, October 22, 2002 5:58 AM
Subject:  Create Table with AutoIncrement-field in M$ AccessDB


> 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
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux