I have the following code:
Code: Select all
$totalrows = $fcount[friends];
$limit = 10;
if(!$page){
$page = 1;
}
$limitvalue = $page * $limit - ($limit);Code: Select all
LIMIT $limitvalue,$limit"Code: Select all
if($page != "1"){
$pageprev = $page - 1;
echo "[<a href='test.php?page=$pageprev'>Previous</a>]";
}
$numofpages = $totalrows / $limit;
$numofpages = ceil($numofpages);
for($j = 1; $j <= $numofpages; $j++) {
if($j == $page){
echo "[$page]";
}
else{
echo "[<a href='test.php?page=$j'>$j</a>]";
}
}
if(($totalrows = ($limit * $page)) > 0){
$pagenext = $page + 1;
echo "[<a href='test.php?page=$pagenext'>Next</a>]";
}for example if there are only 10 rows in the database table and my limit is to show 10 rows per page the Next link will still show which i don't want it to.
Can anybody see a problem with the above code that could be causing this problem?
Any help would me greatly appreciated.
Thanks in advance
Ross