A caveat is that you get the last_insert_id for your connection.  Not the
last one in the database.

Curtis

On Wed, 22 Aug 2001, Dr. Werner Stürenburg wrote:

>
>
> Jari Mäkelä schrieb am Mittwoch, 22. August 2001, 14:57:06:
>
> > At 13:19 22.8.2001 +0200, you wrote:
> >>LAST_INSERT_ID() should return the last autoincrement value of
> >>the last insert
>
> > Yep it sure did, managed to get to machine and test it out. Total mess.
>
> > but;
>
> > $query = "SELECT LAST_INSERT_ID()";
> > $result = mysql_query($query);
> > if ($result) {
> > $nrows = mysql_num_rows($result);
> > $row = mysql_fetch_row($result);
> > $lastID = $row[0];
> > }
>
> > was a code sent to me and if it helps anyone there it is, do not know who
> > is the original author but this takes the Id from first insert in you put
> > it after it and then you can use the $lastID in following inserts, works fine.
>
> Why not use mysql_insert_id(); ????
>
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to