joyce
Tue 4th Jun '02, 11:06pm
Hi, hope u guys can give me a hand on this..
i have to retrieve some info from tables and then add all the fields together, then list out. 10 records per time, then got 2nd page, 3rd page..so on...
my problem is ..i can't get my records to sort(highest point to lowest point), then i decided to use array...
$totalpoint = (($newthread) + ($reply) + ($view) + ($admin_mod) + ($morereply) + ($newadis)) - ($redeem_points);
$arr[totalpoint][] = $totalpoint;
$arr[userid][] = $uid;
}
arsort($arr[totalpoint]);
reset($arr[totalpoint]);
while (list ($key, $val) = each ($arr[totalpoint]))
{
$get_username = mysql_query("select username from user where userid=".$arr[userid][$key]);
list ($name) = mysql_fetch_row($get_username);
echo "<tr bgcolor=#cccccc><td width=50% align=center>$name</td><td width=50% align=center>";
echo "$val</td></tr>";
}
due to the paging problem, the sort is in correct....it will retrieve 10 record for first page, sort it, display it. then second page, retrieve 10 more records..sort it and display it.
wat can i do to solve this?? pls help..
:confused:
i have to retrieve some info from tables and then add all the fields together, then list out. 10 records per time, then got 2nd page, 3rd page..so on...
my problem is ..i can't get my records to sort(highest point to lowest point), then i decided to use array...
$totalpoint = (($newthread) + ($reply) + ($view) + ($admin_mod) + ($morereply) + ($newadis)) - ($redeem_points);
$arr[totalpoint][] = $totalpoint;
$arr[userid][] = $uid;
}
arsort($arr[totalpoint]);
reset($arr[totalpoint]);
while (list ($key, $val) = each ($arr[totalpoint]))
{
$get_username = mysql_query("select username from user where userid=".$arr[userid][$key]);
list ($name) = mysql_fetch_row($get_username);
echo "<tr bgcolor=#cccccc><td width=50% align=center>$name</td><td width=50% align=center>";
echo "$val</td></tr>";
}
due to the paging problem, the sort is in correct....it will retrieve 10 record for first page, sort it, display it. then second page, retrieve 10 more records..sort it and display it.
wat can i do to solve this?? pls help..
:confused: