Re: equivalent to mysql_insert_id()

From: Date: Wed, 30 Jun 2004 20:11:38 +0000
Subject: Re: equivalent to mysql_insert_id()
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-13426@lists.php.net to get a copy of this message
Vern T Takebayashi wrote:
Hi, Please excuse my ignorance as I just started looking at PEAR DB this past weekend. I have some PHP scripts that use the mysql_insert_id() function to return the last ID generated using auto_increment. In PEAR, is using the nextID() function and subtracting one, roughly equivalent to using the mysql_insert_id() function? I suppose that changing the code to use sequences might be better, but I was thinking that the short-term solution would be using the nextID() function in the manner described above.
this should work: mysql_insert_id($db->connection) your solution is not portable anyways .. well your solution is portable across all rdbms that support autoincrement .. so it does have that advantage however substracting 1 makes no sense regards, Lukas Smith smith@backendmedia.com _______________________________ BackendMedia www.backendmedia.com berlin@backendmedia.com Linn Zwoch Smith GbR Pariser Str. 44 D-10707 Berlin Tel +49 30 83 22 50 00 Fax +49 30 83 22 50 07

« previous php.pear.general (#13426) next »