Why is mysqli_insert_id() always returning 0?

前端 未结 4 1993
醉话见心
醉话见心 2020-12-01 14:37

I have the following code. The mysqli_insert_id() (in this case \"$last_row\"), which is supposed to return the last row of the table, is always returning 0. Why is it so?

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-01 15:11

    To get the result, you should place the

    $last_row = mysqli_insert_id($connection);
    

    after your INSERT query

提交回复
热议问题