<html>
<body>
<?php
error_reporting(0);
include('connect.php');
$start=$_REQUEST['start'];
if(empty($start))
{
$start=0;
}
?>
<table align="center" border="0">
<tr>
<td width="30">Sl.No</td>
<td width="100">Name</td>
</tr>
<?php
if(!isset($start))
{
$start=0;
}
$limit=3;
$sql=mysql_query("SELECT * FROM vin_pagination LIMIT ".$start." , ".$limit."");
while($fetch=mysql_fetch_array($sql))
{
?>
<tr>
<td>
<?php echo $fetch['p_id'];?>
</td>
<td>
<?php echo $fetch['p_name'];?>
</td>
</tr>
<?php
}
?>
<tr>
<td colspan="2" align="center">
<?php
$p_sql=mysql_query("SELECT * FROM vin_pagination");
$count=mysql_num_rows($p_sql);
$prev=$start-$limit;
$next=$start+$limit;
if($prev>=0)
{
echo "<a href=\"index.php?start=$prev\" style=text-decoration:none;color:#999999>Prev</a> ";
//displaly number of pages
}
$i=0;
$j=1;
for($i=0;$i<$count;$i=$i+$limit)
{
if($i!=$start)
{
echo "<a href=\"index.php?start=$i\" style=text-decoration:none;color:#999999>$j</a> ";
}
else
{
echo "<a href=\"index.php?start=$i\" style=text-decoration:none><font color=brown>$j</font></a> ";
}
$j++;
}
if($count>$next)
{
echo "<a href=\"index.php?start=$next\" style=text-decoration:none;color:#999999>Next</a> ";
}
?>
<td>
</tr>
</table>
</body>
</html>
<body>
<?php
error_reporting(0);
include('connect.php');
$start=$_REQUEST['start'];
if(empty($start))
{
$start=0;
}
?>
<table align="center" border="0">
<tr>
<td width="30">Sl.No</td>
<td width="100">Name</td>
</tr>
<?php
if(!isset($start))
{
$start=0;
}
$limit=3;
$sql=mysql_query("SELECT * FROM vin_pagination LIMIT ".$start." , ".$limit."");
while($fetch=mysql_fetch_array($sql))
{
?>
<tr>
<td>
<?php echo $fetch['p_id'];?>
</td>
<td>
<?php echo $fetch['p_name'];?>
</td>
</tr>
<?php
}
?>
<tr>
<td colspan="2" align="center">
<?php
$p_sql=mysql_query("SELECT * FROM vin_pagination");
$count=mysql_num_rows($p_sql);
$prev=$start-$limit;
$next=$start+$limit;
if($prev>=0)
{
echo "<a href=\"index.php?start=$prev\" style=text-decoration:none;color:#999999>Prev</a> ";
//displaly number of pages
}
$i=0;
$j=1;
for($i=0;$i<$count;$i=$i+$limit)
{
if($i!=$start)
{
echo "<a href=\"index.php?start=$i\" style=text-decoration:none;color:#999999>$j</a> ";
}
else
{
echo "<a href=\"index.php?start=$i\" style=text-decoration:none><font color=brown>$j</font></a> ";
}
$j++;
}
if($count>$next)
{
echo "<a href=\"index.php?start=$next\" style=text-decoration:none;color:#999999>Next</a> ";
}
?>
<td>
</tr>
</table>
</body>
</html>
No comments:
Post a Comment