Hello Friends,
i am having problem in pagination of my php website
i written the code like this its working for first page good
from second page onwards it showing all the results in a single page
<?php if((!defined('BASEPATH'))) exit('No direct script access allowed');?>
<!-- HEADER -->
<? $this->load->includes('header');?>
<!-- HEADER -->
<table width="100%" height="931" border="0" cellpadding="0" cellspacing="0" background="images/middlebackground.gif">
<tr>
<td align="center" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td><table width="995" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="382"></td>
<td width="613"></td>
</tr>
<tr>
<td width="382" align="center" valign="top">
<table width="378" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top"></td>
</tr>
<tr>
<td height="20" align="center" valign="top">
<!-- SEARCH -->
<? $this->load->includes('search2');?>
<!-- SEARCH -->
</td>
</tr>
<tr>
<td align="left" valign="top"></td>
</tr>
<tr>
<td align="left" valign="top"> </td>
</tr>
<tr>
<td align="left" valign="top"> </td>
</tr>
</table>
<!-- LEFT BANNERS -->
<? $this->load->includes('left_banners4');?>
<!-- LEFT BANNERS -->
</td>
<td width="613" align="left" valign="top">
<table width="613" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- TOP BANNER -->
<? $this->load->includes('top_banner');?>
<!-- TOP BANNER -->
<tr>
<td height="20" align="left" valign="top"> </td>
<td height="20" align="left" valign="top">
<!--<img src="images/banner.gif" width="559" height="208" />-->
<? $this->load->includes('slide');?>
</td>
<td height="20" align="left" valign="top"> </td>
</tr>
<tr>
<td height="20" align="left" valign="top"> </td>
<td height="20" align="left" valign="top"> </td>
<td height="20" align="left" valign="top"> </td>
</tr>
<tr>
<td height="20" align="left" valign="top"></td>
<td height="25" align="left" bgcolor="#04A5C1"><span class="style14"> Featured Hotels And Resorts.</span></td>
<td height="20" align="left" valign="top"></td>
</tr>
<tr>
<td height="20" align="left" valign="top"></td>
<td height="20" align="left" valign="top"> </td>
<td height="20" align="left" valign="top"></td>
</tr>
<?
$page_name="?index6"; // If you use this code with a different page ( or file ) name then change this
$start=$_GET['start'];
if(strlen($start) > 0 and !is_numeric($start)){
echo "Data Error";
exit;
}
$eu = ($start - 0);
$limit = 5; // No of records to be shown per page.
$this1 = $eu + $limit;
$back = $eu - $limit;
$next = $eu + $limit;
$COND .= " hotel_id <> 0 AND is_futured='Y' AND status=1 order by hotel_name limit $eu,$limit";
//$qur="select * from tz_hotels $COND order by hotel_id desc limit $eu,$limit";
//$res1=mysql_query($qur);
//$nume=mysql_num_rows($qur);
//$COND .= " hotel_id <> 0 AND is_futured='Y' AND status=1 order by hotel_name";
$this->res = $this->db->select(Array('hotels'),Array("hotel_id,hotel_name,is_futured,hotel_desc"),$COND);
$this->TCN = $this->db->row_count('hotels',$COND);
print_r($this->TCN);
?>
<!-- HOTEL -->
<tr>
<td height="20" align="left" valign="top"></td>
<td height="20" align="left" valign="top">
<table width="559" border="0" align="center" cellpadding="0" cellspacing="0">
<?
while($row = $this->db->fetch_object($this->res)){
?>
<tr>
<td width="469" height="25" class="main3" >
<span class="main1">
<A HREF=""><?=$this->strings->strip_slashes($row->hotel_name)?></a>
</span>
</td>
<td width="90" rowspan="2">
<!-- IMAGE -->
<div align="right">
<A HREF="">
<img src="uploads/hotels/<?=$this->common->fnHotelImage($row->hotel_id)?>" width="84" height="71" />
</A>
</div>
<!-- IMAGE -->
</td>
</tr>
<tr>
<td class="main3">
<div align="justify">
<span class="style27">
<font color="#636363">
<?=substr($this->strings->strip_slashes($row->hotel_desc),0,165)?>
</font>
</span>
<span class="style39">
<A HREF="" class="readmore"><B>Read More</B></a>
</span>
</div>
</td>
</tr>
<? }?>
<tr>
<td height="15" colspan="2">
<div align="center">
<img src="images/line.gif" width="500" height="8" />
</div>
</td>
</tr>
<tr>
<td height="15" colspan="2" align="center">
<?
//print_r($back);
//$qur2=mysql_query("select * from tz_hotels where hotel_id<>0 AND status=1 ");
//$nume=mysql_num_rows($qur2);
if($this->TCN > $limit ){
// Let us display bottom links if sufficient records are there for paging
/////////////// Start the bottom links with Prev and next link with page numbers /////////////////
echo "<table align = 'center' width='50%' botder='1'><tr><td align='left' width='30%'>hi";
//// if our variable $back is equal to 0 or more then only we will display the link to move back ////////
if($back >=0) {
echo "ROcky";
print "<a href='$page_name?start=$back&limit=$limit'><font face='Verdana' size='2'>PREV</font></a>";
}
echo "</td><td align=center width='30%'>";
$i=0;
$l=1;
for($i=0;$i < $this->TCN;$i=$i+$limit){
if($i <> $eu){
echo " <a href='$page_name?start=$i&limit=$limit'><font face='Verdana' size='2'>$l</font></a> ";
}
else { echo "<font face='Verdana' size='4' color=red>$l</font>";} /// Current page is not displayed as link and given font color red
$l=$l+1;
}print_r($this->TCN);
print_r($this1);
echo "</td><td align='right' width='30%'>";
//print_r($this1);
///////////// If we are not in the last page then Next link will be displayed. Here we check that /////
if($this1 < $this->TCN) {
print "<a href='$page_name?start=$next'><font face='Verdana' size='2'>NEXT</font></a>";}
echo "</td></tr></table>";
//print_r($next);
}
?>
</td>
</tr>
</table>
<?php /*?> </form><?php */?>
</td>
<td height="20" align="left" valign="top"></td>
</tr>
<!-- HOTEL -->
<?php /*?><?}}else{?><?php */?>
<tr>
<td height="20" align="left" valign="top"></td>
<td height="25" align="left" bgcolor="#cccccc">
<div style="padding-top:40px;padding-bottom:40px;" align="center"><FONT SIZE="" COLOR="red" face="vardana">Hotels Is Not Available</FONT></div>
</td>
<td height="20" align="left" valign="top"></td>
</tr>
<tr>
<td align="left" valign="top" colspan="3"> </td>
</tr>
<?php /*?> <?}?><?php */?>
<tr>
<td height="20" align="left" valign="top"></td>
<td height="20" align="left" valign="top" class="main3"><img src="images/add1.gif" width="412" height="54" /></td>
<td height="20" align="left" valign="top"></td>
</tr>
<tr>
<td colspan="3" align="left" valign="top">
<table width="602" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top"> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<!-- FOOTER -->
<? $this->load->includes('footer');?>
<!-- FOOTER -->
so help me
Thanks in advance