I get some data in an array that will be stored in a mysql table. The table field names are the same as keyin the key / value pair in the array, however I do not know in advance which key / value pairs will come
$array1 = array('a'=> 'str1', 'b'=> 'str2', 'c'=> 'str3', 'd'=> 'str4');
$array2 = array('a'=> 'str6', 'c'=> 'str7', 'e'=> 'str5');
$array3 = array('b'=> 'str8', 'd'=> 'str9', 'e'=> 'str10');
Thus, the above indicates the way in which data can flow. Below is an example db table structure
column 1 name = id (auto increment)
column 2 name = 'a'
column 3 name = 'b'
column 4 name = 'c'
column 5 name = 'd'
column 6 name = 'e'
column 7 name = 'f'
Please note that there may be some unexpected data, but if the db field (column) does not exist for this unexpected value, the data should be skipped. I just need to insert data in which a column exists for it, and any non-existent values ββmust be zero for the column. Hope this makes sense to someone.
SQL php?