My current code is going to have to be switched up a LOT I think, as right now, the way I see it, for each new page it will start the ranks back at 0 and go through x -- but here it goes.
Code: Select all
function doRanks() {
$rank = 0;
//$total = 0; Plan was to have total be the total number of users already shown
$query = mysql_query("SELECT * FROM `table` ORDER BY `number` DESC");
$num_sites = mysql_num_rows($query);
while($row = mysql_fetch_array($query)){
$rank++;
if($rank <= 20) {
echo "--User info--";
if ($rank == 12 && $rank != 3)
{
echo "<div class=\"box\">Advertisement #2!</div>";
}
if ($rank == 3)
{
echo "<div class=\"box\">Advertisement!</div>";
}
echo "<div class=\"hr\"></div>";
}
}
if ($num_sites % 20) {
$next = 0;
$next = $next;
$query = mysql_query("SELECT * FROM `table` ORDER BY `id` DESC");
$number = mysql_num_rows($query);
$repeat = ceil($number/$this->max); //So I can set the max number shown?
while ($repeat > 0) {
switch ($repeat) {
case 1:
echo "[<a href='?rank=2'>50-100</a>]";
break;
case 2:
echo "[<a href='?rank=3'>100-150</a>]";
break;
//Would go on, but for testing purposed I only need these two
default:
break;
}
$repeat--;
}
}
}