Re: R: [PHP-WIN] Retrieving ID after INSERT with MSSQL

From: Date: Fri, 15 Dec 2000 17:18:33 +0000
Subject: Re: R: [PHP-WIN] Retrieving ID after INSERT with MSSQL
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-4507@lists.php.net to get a copy of this message
will this work on ODBC too? mok ----- Original Message ----- From: "Fabio R." <fabio@zolnetwork.com> To: "'Flint Doungchak'" <Flint@netsolutionsllc.com>; "'PHP-Windows List (E-mail)'" <php-windows@lists.php.net> Sent: Saturday, December 16, 2000 12:56 AM Subject: [PHP-WIN] R: [PHP-WIN] Retrieving ID after INSERT with MSSQL > Thanx to all. It works great !!! > > Bye, Fabio > > > -----Messaggio originale----- > > Da: Flint Doungchak [mailto:Flint@netsolutionsllc.com] > > Inviato: venerdì 15 dicembre 2000 17.54 > > A: 'Fabio R.'; 'PHP-Windows List (E-mail)' > > Oggetto: RE: [PHP-WIN] Retrieving ID after INSERT with MSSQL > > > > > > Fabio, > > > > You can use the MSSQL function > > > > @@IDENTITY to retrieve the last insert id of a column with an > > indentity > > seed. i.e. is autoincremented by SQL Server. > > > > So, it would look something like this... > > > > $query = "INSERT INTO blah values (a,b,c)"; > > $result = mssql_query($query,$connect); > > > > $query = "SELECT @@IDENTITY"; > > $whatyouwant = mssql_query($query,$connect); > > > > -Flint > > php-list-admin@lists.php.net > > > -- > 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 (#4507) next »