note 82243 deleted from function.mssql-get-last-message by nlopess
| From: | nlopess@php.net | Date: | Thu, 03 Apr 2008 17:10:25 +0000 |
| Subject: | note 82243 deleted from function.mssql-get-last-message by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-137905@lists.php.net to get a copy of this message | ||
Note Submitter: morgon [at] mygamercard [dot] net
----
I found a very cool shortcut when dealing with last insert id's (or IDENTITY as it's
called here)
$q = mssql_query("INSERT INTO TableName(...) VALUES(...) SELECT
LAST_INSERT_ID=@@IDENTITY");
$r = mssql_fetch_assoc($q);
$r['LAST_INSERT_ID'] will contain your new IDENTITY.
Source: http://www.tumanov.com/entry/435