Je cherche à récupérer le dernier id inséré après un pdostatement.
$stmt = Chrono::$myConnexion->prepare("REPLACE INTO participants (id, nom, prenom) values (:id, :nom, :prenom)");
$stmt->bindParam(":id", $this->id);
$stmt->bindParam(":nom", $this->nom);
$stmt->bindParam(":prenom", $this->prenom);
$stmt->execute();
si je fais :$stmt->lastInsertId();
J'ai une erreur : Fatal error: Call to undefined method PDOStatement::lastInsertId() in
En gros, sur un pdostatement, lastinsertid ne fonctionne pas ... Et si je le fais
Chrono::$myConnexion->lastInsertId();
ça me retourne toujours 0 ...Je pense que c'est à cause de mon "replace" ... Mais comment régler le problème ?