rendered paste body
$rank_query = "SET @result_num:=0";
$rank_query2 = "CREATE TEMPORARY TABLE table_name SELECT (@result_num:=@result_num+1) as rank,avg( actual_rating ), being_rated, count(*) FROM ratings GROUP BY being_rated HAVING count(*)>=2 ORDER BY avg(actual_rating) desc";
$rank_query3 = "select * from table_name where being_rated=" .$who_to_rate[0][uid];
//print $rank_query3;
$rank_query4 = "select count(*) from ratings group by being_rated having count(*) >=2";
mysql_query($rank_query);
mysql_query($rank_query2);
$result_x = mysql_query($rank_query4);
//print "<hr>".is_resource($result_x);
$nr = mysql_num_rows($result_x);
print mysql_error();
$result3 = mysql_query($rank_query3);
$temparray = mysql_fetch_row($result3);
$myrank = $temparray[0];
$myrating = $temparray[1];
$num_people_rated_me = $temparray[3];
if (!$myrating) {
$myrating = "(N/A -- needs more ratings)";
$myrank = "(N/A)";
}
if (!$num_people_rated_me) {
$num_people_rated_me = 0;
}