Hello!
Working on a pre-existing program that parses an html form that has a dynamically created number of fields, and in the interest of forward-compatibility, may not even know number of mysql columns...
I imagine that this requires creating two arrays, and comparing/re-ordering of some sort, but can't quite wrap my head around it...
Would this be something like:
A) Database Array - 1) get # of MySQL columns 2) loop through this number and get MySQL column names
B) Form Array - 1) get # of form fields 2) get form field names/values
C) Match Array - match name.form_field[f] to name.mysql_column[c]
D) Execute Insert - insert value of name.form_field[f] into name.mysql_column[c] (INSERT INTO name.mysql_column[c], name.mysql_column[c+2], name.mysql_column[c+5], name.mysql_column[c+n] VALUES value(name.form_field[f]), value(name.form_field[f+9]), value(name.form_field[f+3]), value(name.form_field[f+x]))
I'm guessing the answer is something like the above, but can't quite picture the nested loops required to achieve the result...
Any possible solutions spring to mind out there?
All responses will be greatly appreciated!
Thanks,
Sean McKernan
McK66 Productions