Loading ...
Sorry, an error occurred while loading the content.

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

Expand Messages
  • imran.javed1@ymail.com
    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
    Message 1 of 1 , May 7, 2012
    • 0 Attachment
      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";?>
    Your message has been successfully submitted and would be delivered to recipients shortly.