RE: [PHP-WIN] SQL SELECT while INSERTING

From: Date: Wed, 06 Dec 2000 22:58:18 +0000
Subject: RE: [PHP-WIN] SQL SELECT while INSERTING
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-4334@lists.php.net to get a copy of this message
Nope. You have to insert the record first (otherwise how the heck will MySQL know what the next key is?). After the record is inserted, you can access the key with: mysql_insert_id ([int link_identifier]) See this section of the manual - function.mysql-insert-id.html If you want to know what the next id is BEFORE you insert the record, use the PHPLIB class libraries at http://phplib.netuse.de Cheers, Ignatius > -----Original Message----- > From: Asendorf, John [mailto:JAsendorf@lcounty.com] > Sent: Thursday, 7 December 2000 06:42 > To: Php-Windows (E-mail) > Subject: [PHP-WIN] SQL SELECT while INSERTING > > > Hello all, > > Have a quick question. Can I select an auto-incrementing key > at the same > time I am 'inserting into' a new record... > > using Access ODBC > > like this > > $sql = "INSERT INTO blocked (page,name,email,attempt) VALUES > ('$page','$name','$email','$attempt') > > AND GET THE KEY FROM THIS ENTRY HERE > > ;"; > > Thanks all, > > John > > --------------------- > John Asendorf - jasendorf@lcounty.com > Web Applications Developer > http://www.lcounty.com - NEW FEATURES ADDED DAILY! > Licking County, Ohio, USA > 740-349-3631 > > Vah! Denuone Latine loquebar? Me ineptum. Interdum modo elabitur. > > > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > For additional commands, e-mail: php-windows-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net >

« previous php.windows (#4334) next »