Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2002091

[PHP-DB] mssql: insert a record and return the auto increment ID From: Heiko Mundle (hmundle1 <email protected>)
Date: 09/02/02

I insert a new record with PHP into my MS SQL Server database.
The key is defined with
    auto_id INT IDENTITY(1000,1) NOT NULL,

how do I get the new id to use it in PHP?

To insert the record I use this code:
$sSql = "INSERT INTO myTable (time_in ) VALUES ( getdate() )";
$pResult = mssql_query($sSql, $g_pDBServer);

Thanks a lot for your help

Heiko

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php