I tried looking through some other posts, but didn't see anything exactly what I'm looking for.
I have a DB query
$sql = "INSERT INTO groups(Name) VALUES (:name)";
$dbs = $dbo->prepare($sql);
$dbs->bindParam(":name", $_POST['name'], PDO::PARAM_STR);
$dbs->execute();
$groupID = $dbs->lastInsertId();
That returns this fatal error:
[Tue Dec 20 13:59:23 2011] [error] [client 127.0.0.1] PHP Fatal error: Call to undefined method PDOStatement::lastInsertId() in /media/Storage/www/2011/admin/public/ajax.users.php on line 87, referer: http://localhost/2011/admin/public/menu.php?page=users
According to the php manual for PDO::lastInsertId():
If the PDO driver does not support this capability, PDO::lastInsertId() triggers an IM001 SQLSTATE.
How would I determine if my server supports lastInsertId()? I do not see IM001 in my error log anywhere.
When I run this, the data is inserted fine, but I cannot get its ID to use in the next set of INSERT's that set the group permissions.