PDO Last Insert ID always the right one?

前端 未结 3 1243
忘掉有多难
忘掉有多难 2020-12-03 17:21

I have the following code:

prepare(\"INSERT INTO a_table (id, a_field) VALUES (\'\', (:a_field)\");
$query->bindParam(\":a_field\",          


        
3条回答
  •  隐瞒了意图╮
    2020-12-03 17:50

    No, this situation is impossible. Method $db->lastInsertId() returns last inserted id for this DB conection. In other page will be another connection and another last inserted id.

提交回复
热议问题