All Im trying to do is add up all of the values in the rating column where username = the posted username and spit out one number.. I know this is simple but Im having real probs for some reason... cant seem to work out what should go in the while bit.. i was attempting to use foreach earlier with a equal lack of sucess...
//get the users rating data
//part one- the number of ratings
$getratingdata = "SELECT rating FROM ratings WHERE username = '$membername'";
$ratingdataresult = mysql_query($getratingdata) or die ("could not retrieve rating data because".mysql_error());
if (mysql_num_rows($ratingdataresult) == 0) { $ratedby = 0; }
else { $ratedby = mysql_num_rows($ratingdataresult); }
//part two- the percentage
while($ratingsrow = mysql_fetch_row($ratingdataresult)) { /*add the results together*/ }