$num_pages) $pg = $num_pages; $start = ($pg-1)*20; $result = mysql_query("SELECT name, email From Addressbook ORDER BY name LIMIT $start, $recs_per_page"); // Fetch all results and print them while($o = mysql_fetch_assoc($result)) $list[] = $o['name']; // If Javascript requested, go in here if($js) { $json = array('n'=>$num_pages, 'p'=>$pg, 's'=>$start, 'l' => $list); $JSON = new Services_JSON(); print $JSON->encode($json); // nothing more to output, so quit exit(); } // We come here only if javascript is not requested ?>
=$num_pages?$num_pages:$pg+1); // Display navigation links, disable (via css) links that cannot be selected ?>

See the source code of this script.