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(); ????

-- 
Herzlich

Werner

MySQL in Deutschland: Anpassung, Unterstützung, Schulung für Sie
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Dr. Werner Stürenburg <[EMAIL PROTECTED]>
 / /|_/ / // /\ \/ /_/ / /__   MySQL AB, Consultant
/_/  /_/\_, /___/\___\_\___/   Bielefeld, Germany
       <___/   www.mysql.com   +49-5224-997-407  Fax -409



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