try{
$st = $this->prepare("INSERT INTO thetable (a,b) VALUES (?,?)");
$st->execute(array(5,5));
$id = $this->lastInsertId();
echo $id; // nothing
echo gettype($id); // string
return $id; // and I get NULL returned, this is even weirder...
}catch(PDOException $e){
die($e);
return false;
}
该表具有自动递增的id列。为什么我不能获得id值?
发布lastInsertId函数。 –
http://php.net/manual/en/pdo.lastinsertid.php – Alex
这些值实际上是否被插入? – konsolenfreddy