|
Posted by listerofsmeg01 on 10/08/05 00:24
Newbie here again.
I am trying to find the position of a record using COUNT, but I think I
must be doing something wrong:
$query = "Select COUNT(*) as HPos from Highscores where Score >
$nScore";
$resultid = mysql_query ($query, $chan);
if (!$resultid)
die('Error getting position:' . mysql_error());
$row = mysql_fetch_array($result);
$nPosition = $row['HPos'];
echo "POS=";
echo $nPosition;
I always get a POS of 0 despite there being plenty of rows in the
table. I still get the same even if I take out the "Score > $nScore".
If I run the same query via PHPAdmin it works fine, so I'm obviously
getting some kind of syntax wrong in my PHP script.
Help!
Navigation:
[Reply to this message]
|