How to you insert into MySQL database and returns its id in PHP PDO?
Is there a way to insert 开发者_如何学Gointo MySQL database using PHP PDO and return its id? Or I will just have to search fot its id after insertion?
$pdo_object->lastInsertId();
See documentation
Perhaps you're looking for PDO::lastInsertID
?
精彩评论