Re: Re: Getting last record ID created from DB
| From: | Chris | Date: | Tue, 20 Mar 2007 23:27:52 +0000 |
| Subject: | Re: Re: Getting last record ID created from DB | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-250951@lists.php.net to get a copy of this message | ||
Martin Marques wrote:
On Mon, 19 Mar 2007, Richard Lynch wrote:Which would most likely call the last_insert_id function in mysql ;) -- Postgresql & php tutorials http://www.designmagick.com/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.