Just a quick question.
I have a rating system, which is working fine. Before i decided to store the average system into i used this:
$average = ($row['fin_rating'] + $row['tech_rating'] + $row['doc_rating']) / 3 ;
This just stored the average in a variable and i simply showed it on the screen as
<td>$average</td>
But now i want to store that average in the database. The $average is not being POSTed from anywhere so i cannot use the foreach function or $_POST['average']. The average is created on the fly.
Is there a way i can still use
$average = ($row['fin_rating'] + $row['tech_rating'] + $row['doc_rating']) / 3 ;
and get the results stored in the database?
Do i use while -->
$query = "select * from doc,fin,tech WHERE doc.id=fin.id AND doc.id=fin.id AND doc.id=tech.id";
$result = mysql_query($query) or die ("ERROR");
while ($row=mysql_fetch_assoc($query){
$average = ($row['fin_rating'] + $row['tech_rating'] + $row['doc_rating']) / 3 ;
//And then somehow turn $average into a form method
foreach ($_POST as $average){
$update_average = "UPDATE doc_data SET average = $average WHERE doc.id = $id";
$result_average = mysql_query($update_average) or die ("ERROR");
}
I am also confused on which page im supposed to put this on. On the rating form i am using isset so should i place the script beyond the } else { section or place the script in the file where the overall table is shown.
If you need any coding just say!
Thanks