pdo::lastInsertId() error with SQL Server
| From: | Sady Marcos | Date: | Thu, 29 Mar 2007 17:57:40 +0000 |
| Subject: | pdo::lastInsertId() error with SQL Server | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-251653@lists.php.net to get a copy of this message | ||
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 support this function: driver does not
support lastInsertId()
This is true?
The only way would be executing query "SELECT @@IDENTITY as Id" ?
Thanks for help