Re: pagination is ok but content of the current page is not changed as it should be.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



May be you have sql query problem.
Did you already verify the sql query result is like your expect?

Regards,
--
Fajar Dhumadi



________________________________
 From: "imran.javed1@xxxxxxxxx" <imran.javed1@xxxxxxxxx>
To: php-objects@xxxxxxxxxxxxxxx 
Sent: Monday, May 7, 2012 4:36 PM
Subject:  pagination is ok but content of the current page is not changed as it should be.
 

  
hello there,

I am facing a problem on a project.

Its a php core project. I am having correct url for pagination when i click on a page number given at the bottom of the page. Page number is selected correctly but it does not change the content of the page that should be on other then page #1.

Here is the code. Please review and help to identify the problem.

Thank you in advance.

<?php include "includes/header.php";?>
<div class="inner_container">
<h1>
<?php echo $page_main_heading;?>
</h1>
<div class="service">
<ul>
<?php
if (isset($_GET['pageno'])) {
$pageno = $_GET['pageno'];
} else {
$pageno = 1;
}
$count=1;
$service_query="select *from services where service_status='Active' and page_id='6' order by service_id asc";
$service_execute=mysql_query($service_query);
$count= mysql_num_rows($service_execute) ;
$rows_per_page = 2;
$lastpage= ceil($count/$rows_per_page);

$limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page;
$query="select *from services where service_status='Active' and page_id='6' order by service_id asc $limit";
$result=mysql_query($query);
while($service_row=mysql_fetch_array($result))
{
?>
<li>
<div class="secion_box">
<h2>
<?php echo $service_row['service_title'];?>
</h2>
<img src="<?php echo $service_row['service_image'];?>" alt="" />
<?php echo stripslashes(substr($service_row['service_description'],0 ,162));?>
<a href="pop_up.php?service_id=<?php echo $service_row['service_id'];?>" class="hd_lk" rel="#overlay">
Read more
</a>
</div>
</li>
<!-- POPUP HTML STARTS HERE -->
<div class="apple_overlay" id="overlay"><a class="close"></a>
<div class="content2_rp">
<div class="contentWrap"></div>
</div>
</div>
<!-- POPUP HTML STARTS END -->
<?php
$count++;
}
if ($pageno == 1) {
$prevpage=1;
} else {
$prevpage = $pageno-1;
$prevlink="?pageno=".$prevpage;
//echo $prevlink;
}
?>
<?php
if ($pageno == $lastpage) {
$nextpage=$lastpage;
}else {
$nextpage = $pageno+1;
$nextlink="?pageno=".$nextpage; 
} 
?>
<div style="clear:left;"></div>
</ul>
</div>
<div class="page_nation">
<ul>
<li><a href="<?php echo $prevlink;?>"><<</a></li>
<li><a href="<?php echo $prevlink;?>"> Previous </a></li>
<?php
$page_no=1;
while($page_no<=$lastpage)
{
?>
<li <?php if($pageno==$page_no){?>class="active"<?php }?>><a href="?pageno=<?php echo $page_no;?>"><?php echo $page_no;?></a></li>
<?php
$page_no++;
}
?>
<li><a href="<?php echo $nextlink;?>">Next</a></li>
<li><a href="<?php echo $nextlink;?>">>></a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include "includes/footer.php";?>


 

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux