This question is kind of two-fold - a) am I approaching it in a valid way, and b) how would it be done in php.
I have hundreds of php forms in a legacy site, going forward I am trying to clean up the code and modularise it more.
So I am creating a database functions file, in which I would like to use a general INSERT function. Now, each form will have a totally different table, therefore different fields to insert.
I cannot find the best way to write this function - I was thinking something like this:
function insert_form_data($table, $arr_fields, $arr_values)
In this way, I am unsure how to structure the myqli query function to use the fields and values array when they are unknown.
So is this a valid way to do it, if so, please help with the syntax. Or should I spend the extra time now refactoring everything into using the mvc structure, in which case each table/form would be a 'model' etc..
thx