> (insert row)
> $start = mysql_insert_id();
> (insert more rows)
> $result = mysql_query("UPDATE mytable " .
> "SET col1=MOD(id, 30)" .
> "WHERE id >= " . id);
>
Or, in one go, on the database server:
INSERT INTO mytable(...) VALUES(...);
SET @Id=LAST_INSERT_ID();
UPDATE mytable SET col1=MOD(@Id, 30) WHERE id=@Id;
-- More rows:
INSERT INTO mytable(...) VALUES(@Id, ...);
This should be done in one connection session, otherwise the variable
@Id is cleared.
Best regards
--
Willem Bogaerts
Application smith
Kratz B.V.
http://www.kratz.nl/