Re: Re: Getting last record ID created from DB

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

 



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.

--
 21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
---------------------------------------------------------
Lic. Martín Marqués         |   SELECT 'mmarques' ||
Centro de Telemática        |       '@' || 'unl.edu.ar';
Universidad Nacional        |   DBA, Programador,
    del Litoral             |   Administrador
---------------------------------------------------------
-- 
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