Accessing last created row in PHP/MySQL

前端 未结 4 1883
面向向阳花
面向向阳花 2020-12-11 23:06

How to access the row which has just been inserted into a DB with PHP/MySQL?

I have:

    $sql = \'INSERT INTO `jos_db`.`jos_sections` (`id`,  `name`)         


        
4条回答
  •  佛祖请我去吃肉
    2020-12-11 23:55

    Use mysql_insert_id() function to select last row inserted in database.

    SELECT rows from table where id = last_inserted_id
    

提交回复
热议问题