pdo lastInsertId

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

   I'm unsure of how to obtain the last insert id.

$sql ='INSERT INTO FOO (foo)values(?)';
$sth = $dbh->prepare($sql);

$insert_id = $dbh->lastInsertId;

yields "0".

   How do I get the last insert id? I've seen this done without the
prepare, but I don't wish to alter that


Re: pdo lastInsertId

Jeff schreef:
Quoted text here. Click to load it

It's a method:


Site Timeline