MySql: Insert a row and get the content

后端 未结 5 1415
轻奢々
轻奢々 2020-12-01 18:27

Is it possible to insert a row and get the values inserted in the same query?

Something like...

INSERT INTO `items` (`item`, `number`, `state`) 
(SEL         


        
5条回答
  •  北荒
    北荒 (楼主)
    2020-12-01 18:42

    if you are using php then

    instead of this you can use

    mysql_insert_id();
    

    which will give the id of last inserted record.

    The other data will be same as inserted. Only id will change which you can get by mysql_insert_id()

    So you do not need to run second query.

提交回复
热议问题