Fwd: [PHPLIB] Insert -> select From: Martin Decker (martin.decker <email protected>)
Date: 02/28/00

This one´s easy.

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",....)";
...

Voila.

Martin

*****************************************
Martin Decker, martin.decker <email protected>
Telekommunikationstechnik und -systeme
Fachhochschule Salzburg
Jakob-Haringer-Str. 1a/II/12
Tel. 0664 5775697

-
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.