<?php
$start=0;
$pagesize=10;
if (isset($_GET["pageid"]))
{
$pageid=$_GET["pageid"]-1;
$start=$pageid*$pagesize;
}
mysql_connect("localhost","root","");
mysql_select_db("test");
$query="select count(*) from login";
$result=mysql_query($query);
$row=mysql_fetch_array($result);
echo $rows=$row[0];
$query="select * from login limit $start ,$pagesize";
$result=mysql_query($query);
echo "<table border='1'>";
mysql_num_rows($result);
while($row=mysql_fetch_row($result))
{
echo"<tr><td>".$row[0]."</td><td>".$row[1]."</td></tr>";
}
echo "</table>";
$noofpage=ceil($rows/$pagesize);
for($i=1; $i<=$noofpage; $i++)
{
echo "<a href=\"paging.php?pageid=$i\">$i</a>";
}
?>
No comments:
Post a Comment