Does anyone see what I'm missing here? I think it might be making sure $startpage and $numpages are numberes not strings. My eyes are blurrry. Thanks!

	$numpages = ceil($numpages);
	$startpage = ceil($startpage);
	echo "\n<a href=\"". $_SERVER['PHP_SELF'] ."?page=0\">0</a> ";
	for($i=0; $i<=$numpages; $i++)
	{
		if($i > ($startpage - 2) && $i < ($startpage + 5)) {
			echo "<a href=\"". $_SERVER['PHP_SELF'] ."?page=$i\">$i</a> ";
		}
	}
	echo "\n<a href=\"". $_SERVER['PHP_SELF'] ."?page=$numpages\">$numpages</a> ";

    You could have something like:

    $numpages = (int) ceil($numpages);
        $startpage = (int) ceil($startpage); 
    

    to make sure although you'd need to do that when you assign $numpages and $startpage the first time.

      Write a Reply...