Getting insert id with insert PDO MySQL

后端 未结 2 1184
一生所求
一生所求 2020-12-18 19:28

Im getting to grips with the basics of PDO.

However Im trying to get the id of the inserted row, Im using:

$query = $system->db->prepare(\"INSE         


        
2条回答
  •  执笔经年
    2020-12-18 20:24

    You're probably looking for lastInsertId. "Returns the ID of the last inserted row or sequence value".

    $insertedId = $system->db->lastInsertId() ;
    

提交回复
热议问题