Inserting dynamic table values from PHP array to mysql table : Need help in inserting dynamic fields and values into mysql db table in PHP.
sampe data
$data[]=array('client'=>$clientname, 'amount' => 12000,'balance'=>6000, 'term'=>6,'maturitydate'=>'2016-05-31')

parameters passed to get the above data : branch = branchid, date =cutoffdate

Here's the table structure where I need to insert the above data.

Fields : branch
         date
         account_no
         field
         value
the first two fields values came from the parameters passed, account_no comes from the data after the querying the db using the passed param, for the field value should come from the array index and value is the index value. Been looking around the web for some possible solutions but I cannot find one. 
Any help will be highly appreciated. thank you