PHP mySQL - Insert new record into table with auto-increment on primary key

后端 未结 5 1226
予麋鹿
予麋鹿 2020-12-01 06:02

Wondering if there is a shorthand version to insert a new record into a table that has the primary key enabled? (i.e. not having to include the key column in the query) Lets

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-01 06:58

    You can also use blank single quotes for the auto_increment column. something like this. It worked for me.

    $query = "INSERT INTO myTable VALUES ('','Fname', 'Lname', 'Website')";
    

提交回复
热议问题