In which case, I'd assume that the error lies within your while () loop.
To be honest, I'm struggling to get a handle on your code because it has no defined structure or indentation to make following it easy. From what I have been able to work out, I can't find an end to your while() statement, meaning that your script never runs the second and subsequent passes.
Similarly, examining the source code, there is no </body> or </html> tags so the page is incomplete.
Try adding one } to the very end of the script and see what occurs. By my counting you're one short.
Similarly, you have no specific rules for your self as to how you invoke certain statements. On one hand you use:
if(empty($page))
$page = 1;
Then you use;
if($numofpages>1){echo" (showing: $from - $to)";}
Try restructuring your coding to follow PEAR rules and you'll find it a lot easier to debug. Certainly it may take slightly longer to code, but the pay-back in bug reduction is massive;
while ($this = mysql_fetch_array($query_result) {
$value = $this['blah'];
$another_value = $this['blahblah'];
if ($numofpages>1) {
echo " (showing: $from - $to)";
};
};