Hello.
Your code is not so clear.
You make a reference to $pageprev in the first block, and the way you use it is OK, but then you put an echo statement - but what happens if $page is not != 1 ?
$pageprev should be initialised to $page - I guess you did it, but you forgot to tell it in this post.
Note : the fictitious 'www' links above will show a link, but they don't go anywhere !.. Just type 'www.' in this post and you will display a link. I just put those words as an example, there is no target to "www.blabla" as you can easily imagine !!!
What makes me answering this post is your PREV / NEXT links at the bottom of your web page. It show this information :
* prev :
www.blabla.php?1-1=
* next :
www.blabla.php?1+1=
What are those ?1-1=' and '?1+1=' parameters ? This is not the good way to send 'post' parameters. You should use that way :
* prev :
www.blabla.php?page=z
* next :
www.blabla.php?page=z
Where z is the page number you want to go to. Then in the target page, you can easily catch the "$page" value (as your parameter is called "?page=") via that line :
foreach($HTTP_POST_VARS as $name=>$value) $$name=$value;
If you need more parameters, you can use that way :
www.blabla.php?param1=xxx¶m2=yyy¶m3=zzz
Then after using the "foreach" line above, you get a $param1, $param2 and $param3 set of variables.
Then, back to your issue : using that way to send & catch parameters, you can easily use a "$page" wich is very to use in any SQL limit script.
JP