This is what i have now:
Code:
$query = "SELECT (points_total_".$game.") as total_points
, ( select count(*)+1
FROM apple_users
WHERE total_points > t.total_points
) as ranking
FROM (points_total_".$game.") as total_points
WHERE survey_user_id = ".$_SESSION['user_id']."
ORDER BY total_points DESC
";
$results = mysql_query($query)
or die(mysql_error());
while ($rows=mysql_fetch_assoc($results)) {
extract ($rows);
echo "<table width='320' class='text_main border='0' cellspacing='0' cellpadding='0'>
<tr>
<td width='60' height='20'><div align='center'>".$ranking."</div></td>
<td width='20'> </td>
<td>".$_SESSION['first_name']." ".$_SESSION['last_name']."</td>
<td width='80'><div align='center'>".$total_points."</div></td>
</tr>
</table>";
}
but it is giving me the following error message:
Code:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as total_points WHERE survey_user_id = 81 ORDER BY total_
Bookmarks