mysqli_insert_id: What if someone inserts another row just before I call this?

后端 未结 2 1967
Happy的楠姐
Happy的楠姐 2020-12-20 17:51

My question is a rather simple one. I\'ve read that the recommended method of retrieving the auto_increment/id value of a row I\'ve inserted in mysqli is the mysqli_i

2条回答
  •  南笙
    南笙 (楼主)
    2020-12-20 18:05

    mysqli_insert_id() is specific to the database connection -- it returns the ID of the row that this script invocation inserted most recently, not any other MySQL client. So there's no conflict if multiple applications are inserting into the database at the same time.

提交回复
热议问题