$limit =25;
$query ="select record from table ;
$result_count=mysql_db_query($database,$query,$connection) or die("Error in query1:$query". mysql_error());
$totalrows=mysql_num_rows($result_count);
if($totalrows<=0)
{
echo"<center><br><br><br>No Records found.<br><br><br></center>";
?><center><a href="main.php"><img border='0' src="images/bsearch.gif" ></a></center>
<?
}
else
{
if(empty($page))
$page = 1;
$limitvalue = $page * $limit - ($limit);
$query="SELECT id FROM table WHERE order by any one field Limit $limitvalue, $limit";
$result=mysql_db_query($database,$query,$connection) or die("Error in query2:$query". mysql_error());
$count_result=mysql_num_rows($result);
// Display links at the top to indicate current page and number of pages displayed
$numofpages = ceil($totalrows / $limit);
$from=$limit*$page-$limit+1;
$to=$from + $count_result-1;
// start 123 next>> table
?>
<table align="center" width="100%" cellpadding="0" cellspacing="o">
<tr><td width="30%" hight="15" bgcolor="#A6D0FF" align="left">
<?
echo"<b>Books</b> : $from to $to of $totalrows"; ?>
</td>
<td width="20%" hight="15" bgcolor="#A6D0FF" align="center">
<a href="searchengine.php">New Search</a>
</td>
<td width="50%" border="0" bgcolor="#A6D0FF"; align="right">
<?if($numofpages>1){?>
<b>Go to page:</b> <?}?>
<?php
// display previous link if page is not 1
if($page != 1)
{
$pageprev = $page - 1;
echo("<a href='$PHP_SELF?page=$pageprev&Docu_type=$Docu_type&sessid=$sessid&count=$count'><img border='0' src='back.gif'></a> ");
}
// display page nos if not 1
for($i = 1; $i <= $numofpages; $i++)
{
if($numofpages>1){
if($i == $page)
{?> <font size="4"><?echo"[$i]";?></font> <?}
else
echo" <a href='$PHP_SELF?page=$i&Docu_type=$Docu_type&sessid=$sessid&count=$count'><font size=2>$i</font></a> ";
}
}
// display next page link if there is more than one
if(($totalrows - ($limit * $page)) > 0)
{
$pagenext = $page + 1;
echo("<a href='$PHP_SELF?page=$pagenext&Docu_type=$Docu_type&sessid=$sessid&count=$count'><img border='0' src='next.gif'></a>");
}
// end 123 next>> table
?>
</td></tr>
</table>
<table width="100%" border="0" cellpadding="3" cellspacing="3">
<?php
$x=$from-1;
while($row=mysql_fetch_array($result))
{
$qid=$row['id'];
$x=$x+1;
?>
<tr>
<td width="5%" align="center" valign="top" style="background-color: #ECF5FF"><?echo"$x";?></td>
<td width="95%" style="background-color: #ECF5FF" wrap>
<?php
$query="SELECT * FROM table WHERE id='$qid'";
$result3=mysql_db_query($database,$query,$connection) or die("Error in query3:$query".
mysql_error());
{ <?print("<br>".datahere );?></a><?
}
}
?>
</td></tr>
<?}
mysql_free_result($result);
mysql_close($connection);
?>
</td></tr>
</Table>