>Here's how I mostly do it (albeit simplified):
>$query = "INSERT INTO `sometable`(`title`,`content`)
>$result = mysql_query($query);
>$autoId = mysql_insert_id($result);
>$query = "INSERT INTO `another_table`(`link_id`,`value`)
>$result = mysql_query($query);
>No need to call another query to retrieve the last inserted id, as it is
>tied to the last query executed within this session.

[JS] Ashley is absolutely right, I'd forgotten about the mysql_insert_id
shorthand. (I'm a one-man band, and for the last week or two I've been
immersed in VB for Access forms.) Not only is she right, but her way is
better. Presumably a language's internal code is maintained as the specific
database changes. You can make yourself more independent of the specific
database by using the PDO abstraction, although I would save that for a
rainy weekend.

Jerry Schwartz
The Infoshop by Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032
860.674.8796 / FAX: 860.674.8341

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

Reply via email to