$conn=mysql_connect("localhost","root","123");
mysql_select_db("qq",$conn);
mysql_query("名前の設定utf8");
$length=5;
$pagenum=isset($_GET['page'])?$_GET['page']:1;
$totsql="select count(* ) from q1";
$totarr=mysql_fetch_row(mysql_query($totsql));
$pagetot=ceil($totarr[0]/$length);
if($pagenum>=$pagetot) {
$pagenum=$pagetot;
}
$offset=($pagenum-1)*$length;
$sql="ID 制限による q1 順序から * を選択 {$offset}, {$length}";
$ret=mysql_query($sql);
echo "
";
echo "" ;
while($row=mysql_fetch_assoc($ret)){
echo "";
echo "{$row['id']} | ";
echo "{$row['name']} | ";
echo "{$row['pass']} | ";
echo "
";
}
echo "
";
$prevpage=$pagenum-1;
$nextpage=$pagenum 1;
echo "";
echo " ";
mysql_close($conn);
?>