Re: Re: Getting last record ID created from DB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Martin Marques wrote:
On Mon, 19 Mar 2007, Richard Lynch wrote:


The MySQL developers spent a zillion hours making the LAST_INSERT_ID()
function be tied to YOUR database connection.

You get *your* LAST_INSERT_ID(), not some random one from some other
database connection.

That's why http://php.net/mysql_insert_id takes the connection as an
argument.  Okay, so it's an optional arg, and PHP uses the last-used
connection by default, but that's another issue entirely...

Best thing would be to use DB or MDB2 and let the object get the last id with it's internal functions. IMHO.

Which would most likely call the last_insert_id function in mysql ;)

--
Postgresql & php tutorials
http://www.designmagick.com/

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux