MySQL INSERT two fields only
insert, mysql, php
Solution
Yes, specify the column names after the table name:
INSERT INTO table (column1, column2) VALUES ('','$id')
Problem
I have a table with quite a few columns. The total number of columns is not yet specified, and will change on a regular basis. In my insert query, I only need to put two values into the table. All other values will be ' '. is there a way to only specify the first fields, without having to include '','','',''...? Please see below for example: I would like to have this: ``` $query = mysql_query("INSERT INTO table VALUES('','$id')"); ``` Rather than this: ``` $query = mysql_query("INSERT INTO table VALUES('','$id','','','','','',''......and on and on...)"); ``` Is there a way to do this? Thanks!