if there is 10, 20, 30(rows) and so on..
it makes one extra blank page.. this is a small but a tricky bug.. please help.. here is the code:
Code: Select all
$limit = "10";
if (!isset($sites) || $sites==0) {
$sql = "SELECT * FROM $table WHERE topic_id=$topicid ORDER BY reply_date LIMIT $limit";
}
else {
$l_sites = $sites*$limit;
$sql = "SELECT * FROM $table WHERE topic_id=$topicid ORDER BY reply_date LIMIT $l_sites,$limit";
}Code: Select all
$num_result = mysql_query("SELECT * FROM $table WHERE topic_id= '" . $topicid . "'") or die (mysql_error());
$num_s = mysql_num_rows($num_result) or die (mysql_error());
@mysql_free_result($num_result);
$sitez = $num_s/$limit;
if(gettype($sitez) == "double"){
settype( $sitez, "integer");
}
if ($sitez >= "1") {
echo "Goto page: ";
for($x_sites = 0;$x_sites <= $sitez; $x_sites++) {
$y_sites = $x_sites;
if($sites == $x_sites) {
$y_sites++;
echo "<font color="red" size=4>$y_sites</font>\n"; }
else {
$y_sites++;
echo "<a href="list.php?sites=$x_sites">$y_sites</a>\n"; }
}
}