Re[2]: [PHP-WIN] SQL SELECT while INSERTING
| From: | Gonzalo Vera | Date: | Wed, 06 Dec 2000 23:16:13 +0000 |
| Subject: | Re[2]: [PHP-WIN] SQL SELECT while INSERTING | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-4336@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])
Hmmm... ok for MySQL, but I think access is a little different. At
least when you manually add a record, the key is assigned immediately.
I'll do some experimenting and call back if I get something.
Gonzalo.
>> -----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
>>