(mysql, php) How to get auto_increment field value before inserting data?

前端 未结 8 789
挽巷
挽巷 2020-11-29 11:10

I\'m uploading image file to storage server. Before uploading I should compose filename, which contains AUTOINCREMENT VALUE in it (for example, 12345_filename.jpg).

8条回答
  •  甜味超标
    2020-11-29 11:57

    INSERT INTO CONTACTS1 (firstname, lastname) values('hi', select auto_increment from information_schema.TABLES where TABLE_NAME='CONTACTS1' and TABLE_SCHEMA='test')

    Where ID is the Primary Key & Auto number column.

提交回复
热议问题