Averaging user-entered form data in a SQL database
Can anyone school me on how to have MySQL via Codeigniter syntax average
form data and insert it into the corresponding database table upon
submission?
I am able to collect the form information and store it in the database
correctly. I just don't know the general coding for averaging the data and
storing it in the appropriate column of table.
For instance: If the user enters five test scores: 98 99 46 93 and 55 and
presses "Submit" each item is successfully inserted in its correct column
in the table ('test1', 'test2', 'test3', 'test4', and 'test5'). However, I
would like the sixth column to be the average of the scores (i.e.
'test_avg'). But, I don't know how to code that part of the process.
No comments:
Post a Comment