heres wat ive got right now:
$getratingid = mysql_query("SELECT id from table1 where submittedbyuser = '$_SESSION[username]'");
while($ratingid = mysql_fetch_array($getratingid)) {
$locid = $ratingid['id'];
$getratingl = mysql_query("SELECT SUM(total_value) as sum, SUM(total_votes) as sumtwo from ratings where id = '$locid'");
$ratingl = mysql_fetch_array($getratingl);
echo $ratingl[sum]/$ratingl[sumtwo]; //getting the rating here
}
this displays individual values from each loop where id = $locid.
ill give an equivalent example of what im tryin to do that is simpler:
imagine a database of people with id and ages in one table (table2) and locations and the same id value in another table (table1). what i want to do is draw out all the ages from table2 where the id's from each table match and then get the sum of all of those ages.
my code right now is the giving me the equivalent of each age. what i cant seem to do is get all of the values after the loop has finished and sum them