Re: Insert ID

From: Date: Thu, 15 Aug 2002 07:49:37 +0000
Subject: Re: Insert ID
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-2121@lists.php.net to get a copy of this message
Am Fri, 14 Jun 2002 17:10:52 +0200 schrieb Tom Southwood <schmoose@netheads.co.za>: > You people may have heard this one many times but here goes. > > Whats the easiest and most database independent way of getting an id back > from an insert you have just performed using Pear. "The easiest and most database independent way" would be _not_ to get an id _back_, but to get the next id for your insert _before_ it is performed. To achieve this, use sequences instead of auto_increment fields. PEAR::DB emulates sequences for databases that don´t support them natively (like MySQL). For a quick usage example, look here: http://pear.php.net/manual/en/core.db.tut_sequences.php Regards, Markus -- *21st Media* | Consulting, Konzeption, Produktion für die Bereiche: Markus Wolff | Internet, Intranet, eCommerce, Content Management, Hamburg,Germany | Softwareentwicklung, 3D-Animation, Videostreaming http://21st.de | Tel. [+49](0)40/6887949-0, Fax: [+49](0)40/6887949-1

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