I'd like to use a foreach loop to insert a _POST associative array into a database using INSERT INTO.
What I need to know, is if my _POST data contains keys that don't match the columns of my database, will INSERT INTO simply create these columns in the database?
if not, will it return an error and not update my database at all? or will it return an error but still update my database with as many valid entries as possible?
I'd prefer the last situation. This is what I'm looking to do:
A user fills out a form with mulitple fields -> I do something with the responses in _POST, maybe some calculations in javascript, or send an email -> I store some, but not all, of the fields in my database for future reference, looping through the array and storing everything that matches seems to be the simplest way to do this.
Ideally, I'd like to be able to reuse this code in different situations so here I'm looking to gain a more detailed and subtle understanding of how INSERT INTO operates.