Date: 02/28/00
- Next message: Shandy Brown: "[PHPLIB] Atomicity"
- Previous message: Michael S. Steuer: "RE: [PHPLIB] Insert -> select"
- In reply to: Martin Decker: "Fwd: [PHPLIB] Insert -> select"
- Next in thread: Martin Decker: "Fwd: [PHPLIB] Insert -> select"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, 28 Feb 2000, Martin Decker wrote:
> 1) Just create a table db_sequence in your database, looking like:
>
> CREATE TABLE db_sequence (
> seq_name varchar(127) NOT NULL,
> nextid int(10) unsigned DEFAULT '0' NOT NULL,
> PRIMARY KEY (seq_name)
> );
>
> 2) Make sure there is the following line in your db_mysql.inc (or the
> pendant, if you use another dbms)
>
> var $Seq_Table = "db_sequence";
>
> 3) and finally before inserting write:
>
> $id = $db->nextid("tablename");
> ...
> $sql = "insert into tablename ($id, "text",....)";
> ...
This is the portable way, and should work in any decent
database. Autoincrement is MySQL specific feature that doesn't require an
extra table.
-- Tot ziens,Bart-Jan
- PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>. To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in the body, not the subject, of your message.
- Next message: Shandy Brown: "[PHPLIB] Atomicity"
- Previous message: Michael S. Steuer: "RE: [PHPLIB] Insert -> select"
- In reply to: Martin Decker: "Fwd: [PHPLIB] Insert -> select"
- Next in thread: Martin Decker: "Fwd: [PHPLIB] Insert -> select"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

