Re: [PHP] pdo::lastInsertId() error with SQL Server

2007-03-31 Thread Richard Lynch
On Thu, March 29, 2007 12:57 pm, Sady Marcos wrote: > > hey.. > I am not obtaining use the function pdo::lastInsertId() with sql > My code: > > $db = new PDO("mssql:host=host;dbname=database","user","password"); > $sql = "INSERT INTO users(name,status) VALUES('username','1)"; Are you really mi

Re: [PHP] pdo::lastInsertId() error with SQL Server

2007-03-29 Thread Dan Shirah
use scope_identity() if you're using MS SQL Server 2000 or newer. scope_identity slects the last id within your current scope (The last record you entered in your current session) On 3/29/07, Sady Marcos <[EMAIL PROTECTED]> wrote: hey.. I am not obtaining use the function pdo::lastInsertId()

[PHP] pdo::lastInsertId() error with SQL Server

2007-03-29 Thread Sady Marcos
hey.. I am not obtaining use the function pdo::lastInsertId() with sql My code: $db = new PDO("mssql:host=host;dbname=database","user","password"); $sql = "INSERT INTO users(name,status) VALUES('username','1)"; $db->query($sql); $db->lastInsertId(); Error: SQLSTATE[IM001]: Driver does not suppo