Wednesday, August 6, 2014

PAGING BY NUMBERS LENGTH

<?php
include("./connections/connect.php");
$sql="SELECT count(student.grno) from student";
$res=mysql_query($sql);

while($row=mysql_fetch_array($res,MYSQL_NUM))
{

$pages=$row[0]/5;
}
echo "No of pages....:",$pages;
echo "<table><TR>";
for($x=0;$x<=($pages*5);$x=$x+5)
{
echo "<TD><a href='paging.php?nor=".$x."'>",$x,"-",$x+5,"</a> | </td>";
}
echo "</table></TR>";

$sql = "SELECT STUDENT.GRNO,STUDENT.NAME,CITY.CNAME FROM STUDENT,CITY WHERE STUDENT.CITY=CITY.CID ORDER BY student.GRNO ASC LIMIT ".($_REQUEST["nor"]+1).", 5 ";
$res=mysql_query($sql);
echo "<table>";
while($row=mysql_fetch_row($res))
{
echo "<TR>";
foreach($row as $k=>$v)
{
echo "<TD>",$v,"</td>";
}
echo "</tr>";

}
echo "</table>";
?>


No comments: