There is a table SUBJ. In it, the fields
result . Filled with:
subj_id | subj_credit|result| 1 | 3 | 9 | 2 | 3 | 8 | 3 | 2 | 8 |
$result = mysql_query("SELECT subj_id, subj_credit, result from subjects"); $credits = mysql_Fetch_array($result);
According to the book, I understood that $ credit is an array. I need to do the following:
RATING = (КРЕДИТ1*РЕЗУЛЬТАТ1 + КРЕДИТ2*РЕЗУЛЬТАТ2 + КРЕДИТ-N*РЕЗУЛЬТАТ-N)/СУММАКРЕДИТОВ
Here CREDIT1, CREDIT2, etc. - these are results from subj_credit . RESULT1, RESULT2 - values from result .
Tell me how to do it programmatically. I understood something like this:
- First, I count the number of records in the database:
$kolvo = count($credits);read as long as there are records in the database.
- But then in the implementation I xs. ((
Where to dig at least.