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 missing the ' after the 1?
Perhaps "not support" means "you didn't do an insert in the first
place"???
Probably not, but just wanted to be sure it wasn't a simple typo
tripping you up.

> $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
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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

Reply via email to