Re: Re: Getting last record ID created from DB
| From: | Martin Marques | Date: | Tue, 20 Mar 2007 11:58:49 +0000 |
| Subject: | Re: Re: Getting last record ID created from DB | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-250903@lists.php.net to get a copy of this message | ||
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
---------------------------------------------------------