note 37126 added to ref.odbc
| From: | vbwebprofi at rn2 dot php dot net | Date: | Tue, 04 Nov 2003 09:31:21 +0000 |
| Subject: | note 37126 added to ref.odbc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-59851@lists.php.net to get a copy of this message | ||
On my search for a function to retriew the NewID of an inserted row wich has an autoincrement I
found this solution like the mysql_insert_id for an ODBC connection to MS-Access :
<?
// make your connection below
$Connection = odbc_connect(...);
$Result = odbc_exec($Connection, "select @@identity");
$NewID = odbc_result($Result, 1);
odbc_free_result($Result);
// make here all what you want with the NewID
odbc_close($Connection);
?>
In my mind this should also work with MS-SQL-Server and with Sybase - via ODBC and direct
(mssql_.../sybase_...).
HTH ...
Regards
Holger
----
Manual Page -- http://www.php.net/manual/en/ref.odbc.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37126
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37126&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37126&report=yes
Search -- http://master.php.net/manage/user-notes.php