connect og disconnect code skal du selv sætte på.
$n=(empty($_GET['n']))?0:$_GET['n'];
$res=mysql_query('SELECT SQL_CALC_FOUND_ROWS * FROM table LIMIT 1 OFFSET '.$n);
$res2=mysql_query('SELECT FOUND_ROWS()');
$rowd=mysql_fetch_array($res,MYSQL_ASSOC);
var_dump($rowd);
$total=mysql_fetch_array($res2,MYSQL_NUM);
for($i=0;$i<$total[0];$i++){
if($i==$n){
print($i);
}else{
print('<a href="?n='.$i.'">'.$i.'</a>');
}
}