Let's say I want to insert this data:
Row 1: People = '40', Places = '15'
Row 2: People = '5', Places = '10'
I understand that this is how you'd execute the above:
mysql_query("INSERT INTO mytable(`People`, `Places`)
VALUES ('40', '15'),('5', '10')");
But what if I wanted to insert into more than two columns with a single query? What if the data to be inserted was like this:
Row 1: People = '40', Places = '15'
Row 2: People = '5', Places = '10'
Row 3: Things = '140', Ideas = '20'
Row 4: People = '10', Things = '5', Ideas = '13'
I can't seem to find a question like this anywhere else.
Or if you want to use 0 instead of null, it will likely be more friendly to you application (no throwing null errors)
You could write separate query statements in one single line like this:
and so on
the structure to mount the statement dinamically may be complex to build, but at least is the only solution i can figure out for u at the moment
hope this helps you
Leave the columns you don't wanto to fill with
null