The first problem is that you are resetting variable $result inside the loop, so the next fetch won't work (but you probably already know that).
I'd just update all the rows first with a single update, then select them. I'd also pick a different name for the table, since "table" is a reserved word in SQL.
I didn't test this. If any of the columns are integers you might have to deal with roundoff errors in the division
$dbQuery="update MyTable set totalscore = firstval*secondval/( wone+wtwo)";
$result = mysql_query($dbQuery,$db);
$dbQuery="SELECT firstval, wone, secondval, wtwo, totalscore FROM MyTable";
$result = mysql_query($dbQuery,$db);
$i = 0;
while ($row = mysql_fetch_array($result)){
totalscore[$i]=$row['totalscore'];
$i++;
}