php - Pagination-How to display the results per page? -


i have done scripting display 40 results per page,but cant let user see remaining results in next page.i getting data using curl operation.

i not posting code because lengthy. please check link

so,how can display remaining results on next page?

sorry,if there mistake in question. thank you

 if($search_results['api']['status']=="success") {  $inc= 1; $ert = $search_results['result']['properties'];  if($sortby=='name'){   foreach ($ert $name) {     $names[] = $name['name'];  } array_multisort($names, sort_asc, $ert); }  if($sortby=='overallrating'){   foreach ($ert $name) {     $names[] = $name['avgrating'];  } array_multisort($names, sort_numeric,sort_desc, $ert); }  if($sortby=='price'){   foreach ($ert $name) {     $tuti = array_keys($name['bedprices']['cheapestprivate']);      // echo $name['bedprices']['cheapestprivate'][$tuti[0]];     $names[] = $name['bedprices']['cheapestprivate'][$tuti[0]];  } array_multisort($names, sort_numeric,sort_asc, $ert); }    // var_dump($ert['bedprices']);                         foreach($ert $hostels)                     { if($inc>$page_limit){     continue; }                          if(!((int)$hostels['avgrating'] >= (int)$min_rate && (int)$hostels['avgrating'] <= (int)$max_rate))                             continue;                         if(!((int)$hostels['bedprices']['cheapestprivate']['usd'] >= (int)$min_pricing && (int)$hostels['bedprices']['cheapestprivate']['usd'] <= (int)$max_pricing))                             continue;                         if(!(in_array($hostels['type'],$properties_zan_array)))                             continue;                             // var_dump($hostels);                             $arry_hostel = (array) $hostels;                             foreach ($arry_hostel['roomtypes'] $hkey => $hvalue) {                               if(arrayinstring($roomtype_zan_array,$hvalue['description'])){                                echo $hostels[0]['resultcount'];                          ?>                         <?php $propnum1 =$hostels['number']; ?>                         <div class="search_result">                 <div class="se_img">                      <div class="top_rated">top rated</div>                      <form action='hostel-details' method='get'>                             <input type='hidden' name='hname' value='<?php echo $hostels['name'];?>'>                                 <input type='hidden' name='city' value='<?php echo "$citi" ;?>'>                                     <input type='hidden' name='date_st' value='<?php echo "$startdate" ;?>'>                                         <input type='hidden' name='date_end' value='<?php echo "$enddate" ;?>'>                                             <input type='hidden' name='num' value='<?php echo "$num" ;?>'>                                             <input type='hidden' name='propnum' value='<?php echo "$propnum1" ;?>'>                                                     <input type='hidden' name='guestnum' value='<?php echo $guests?>'>                      <a href='#' onclick='this.parentnode.submit()'>                         <img src="<?php echo $hostels['images']['0']['url'] ?>" height="80" width="120" class="search_img" title="<?php echo $hostels['name']; ?>" />                     </a>                     <span><?php echo $hostels['type']; ?></span>                 </div>                 <div class="se_detail">                        <form action='hostel-details' method='get'>                             <input type='hidden' name='hname' value='<?php echo $hostels['name'];?>'>                                 <input type='hidden' name='city' value='<?php echo "$citi" ;?>'>                                     <input type='hidden' name='date_st' value='<?php echo "$startdate" ;?>'>                                         <input type='hidden' name='date_end' value='<?php echo "$enddate" ;?>'>                                             <input type='hidden' name='num' value='<?php echo "$num" ;?>'>                                             <input type='hidden' name='propnum' value='<?php echo "$propnum1" ;?>'>                                                     <input type='hidden' name='guestnum' value='<?php echo $guests?>'>                     <!--<a href="#" onclick='this.parentnode.submit()' style="font-size: 14px;">-->                     <a href="#"><button style="border: none;"><font style="color:blue">                     <h2 class="se_title" ><?php echo $hostels['name']; ?></h2>                     <!--</a>                      </form>-->                     <div class="se_meta"><?php echo $hostels['address1'].", ".$hostels['address2'] ?></div></font></button></a></form>                         <?php $propnum =$hostels['number']; ?>                     <!-- <div class="se_warning">minimum stay of 4 nights selected dates</div> -->                     <div class="se_desc"><?php echo substr($hostels['shortdescription'],0,80)."..." ?> <!-- <a href="#">more info</a> -->                    <form action='hostel-details' method='get'>                              <input type='hidden' name='hname' value='<?php echo $hostels['name'];?>'>                                     <input type='hidden' name='city' value='<?php echo "$citi" ;?>'>                                       <input type='hidden' name='date_st' value='<?php echo "$startdate" ;?>'>                                         <input type='hidden' name='date_end' value='<?php echo "$enddate" ;?>'>                                             <input type='hidden' name='num' value='<?php echo "$num" ;?>'>                                             <input type='hidden' name='propnum' value='<?php echo "$propnum" ;?>'>                                                     <input type='hidden' name='guestnum' value='<?php echo $guests?>'>             <!--            <input type='hidden' name='search_res' value='<?php echo base64_encode(serialize($hostels)); ?>' /> -->                         <a href='#' onclick='this.parentnode.submit()'>more info</a>                 </form>                      </div>                      <div class="se_review">                          <?php  if($hostels['avgrating']==0)                                 {                                     echo '<span style="font-weight:bold;float:left;">no rating</span>';                                 }                                 else                                 {                                     echo '<div class="se_per">'.$hostels['avgrating']."%".'</div>';                                 }                         ?>                          <a href="#">                                 <?php if($hostels['starrating']!='none' &&$hostels['starrating']!=0)                                         {                                             echo $hostels['starrating']." total reviews";                                         }                                     else                                         echo '<span style="font-weight:bold;"> no reviews</span>';                                 ?>                         </a>                         <div style="clear:both;"></div>                     </div>                      <div class="se_compare">                         <!--<input type="checkbox" class="comp_check"/>                          <label class="cmp">compare (0 of 5)</label> -->                     </div>                 </div>                  <div class="se_price">                         <?php if(!empty($hostels['bedprices']))                             {                                 if(isset($hostels['bedprices']['cheapestdorm']))                                 {                                     foreach($hostels['bedprices']['cheapestdorm'] $currency=>$price){                                         echo    '<div class="do_form">dorms from</div>';                                         echo    '<div class="do_price">'.$currency.$price.'</div>';                                     }                                 }                                 if(isset($hostels['bedprices']['cheapestprivate']))                                 {                                     foreach($hostels['bedprices']['cheapestprivate'] $currency=>$price)                                     {                                         echo '<div class="do_form">privates from</div>                                                 <div class="do_price">'.$currency.$price.'</div>';                                     }                                 }                             }                         ?>                          <div class="book_btn">                         <form action='hostel-details' method='get'>                              <input type='hidden' name='hname' value='<?php echo $hostels['name'];?>'>                                     <input type='hidden' name='city' value='<?php echo "$citi" ;?>'>                                       <input type='hidden' name='date_st' value='<?php echo "$startdate" ;?>'>                                         <input type='hidden' name='date_end' value='<?php echo "$enddate" ;?>'>                                             <input type='hidden' name='num' value='<?php echo "$num" ;?>'>                                             <input type='hidden' name='propnum' value='<?php echo "$propnum" ;?>'>                                                     <input type='hidden' name='guestnum' value='<?php echo $guests?>'>             <!--            <input type='hidden' name='search_res' value='<?php echo base64_encode(serialize($hostels)); ?>' />-->                          <a href='#' onclick='this.parentnode.submit()'>book now</a>                         </div>                 </div>                 <div style="clear:both;"></div>             </div>                          <?php break;                             }                 }                  $inc++;                 }  echo $inc;               } 

try modifying php code :

// set number of records display per page.  $display = 10;  // check if number of pages has been determined.  if(isset($_get['$p']) && is_numeric($_get['$p'])) { $pages = $_get['$p']; } else { $q = "select count(user_id) users"; $r = mysqli_query($dbc,$q); $row = mysqli_fetch_array($r,mysqli_num); $records = $row[0];  // count number of pages  if($records > $display) { // more 10 records = 1 page     $pages = ceil($records/$display); } else {     $pages = 1; } } // end of if set $page  // determine in database start returning results...eg. page 1 , 2 or 3  if(isset($_get['s']) && is_numeric($_get['s'])) { $start = $_get['s']; } else { $start = 0; }  // section displaying links other pages in table if necessary  if($pages > 1) { echo '<br/><p>'; $current_page = ($start/$display) + 1;  // if not first page make previous button if($current_page != 1) {     echo '<a href="view_users.php?s='.($start -       $display).'&p='.$pages.'&sort='.$sort.'">previous</a> '; } // make numbered pages inside (if current page)      ($i = 1; $i <= $pages; $i++) {         if ($i != $current_page) {             echo '<a href="view_users.php?s='.(($display*($i - 1))).'&p='.$pages.'&sort='.$sort.'">'.$i.'</a> ';             }             else {                 echo $i.' ';             }     } // make next link if not last page  if($current_page != $pages) {     echo '<a href="view_users.php?s='.($start + $display).'&p='.$pages.'&sort='.$sort.'">next</a>'; } echo '</p>'; } 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -