Jump to content

schedules over multiple pages


daniellord32

Recommended Posts

hello folks

My name is Daniel and I am new to the forums.

I am helping out a friend with the set up of his VA and their schedules will be over 10k in number. This will be a strain for the browser to load into one page. my plan is to paginate so that they will display a certain number say 50 to each page. I've searched the forums and google and have tried out a few different approaches with no success. Would anybody have a look at the code to see if I have don't something wrong?

thank yo for any help

Dan

  <script type="text/javascript">
	 $(document).ready(function()
         {
             $('#mytable').dataTable
              ( {
               "sPaginationType": "full_numbers"
		    } );
         } );
       </script>
	  <div class="page-title-container">
	    <div class="container">
		    <div class="page-title pull-left">
			    <h2 class="entry-title">Flight Result</h2>
		    </div>
	    </div>
    </div>	
 <section id="content">
	    <div class="container">
		    <div id="main">
			    <div class="row">
				    <div >
					    <div class="flight-list listing-style3 flight">
						    <table id="mytable" class="standard-table" style="text-align:center;">
 <thead>
   <tr>
      <th style="width: 1%;text-align: center;">Airline</th>
      <th style="width:1%;text-align: center;">Flight</th>
      <th style="width:1%;text-align: center;">Dep</th>
      <th style="width:1%;text-align: center;">Arr</th>
      <th style="width:9%;text-align: center;">Aircraft</th>
      <th style="width:9%;text-align: center;">Distance</th>
      <th style="text-align: center;" >Information</th>
      <th style="text-align: center;" >Information</th>
   </tr>
</thead>
<tbody><article class="box">
    <?php foreach($schedule_list as $schedule) { ?>
  <tr>
  <td>
  <span>	  
       <img style="width: 200px;" title="<?php echo $airlines->name ?> " alt="<?php echo $airlines->name ?>" src="<?php           echo SITE_URL; ?>/lib/skins/one/images/airline_logo_code/<?php echo $schedule->code ?>.png">
  </span>                         
</td>
<td style="font-weight: 100;font-size: 15px;">
   <?php echo $schedule->code . $schedule->flightnum?>
</td>
 <td style="font-weight: 100;font-size: 15px;">
      <b><?php echo $schedule->depicao ?></b>
 </td>
 <td style="font-weight: 100;font-size: 15px;">
      <b><?php echo $schedule->arricao ?></b>
 </td>
<td style="font-weight: 100; width:9%;font-size: 15px;">
  <?php echo $schedule->aircraft; ?>
</td> 
<td style="font-weight: 100; width:9%;font-size: 15px;">
   <?php echo "{$schedule->distance}"; ?>
</td>
<td>
   <div   class="details col-xs-9  col-sm-10">
      <div  class="details-wrapper">
          <div class="first-row">
             <div>
                  <h4 class="box-title">
                  <?php echo $schedule->depname ?> to <?php echo $schedule->arrname ?></h4>
             </div>
		</div>
       <div class="second-row">
          <div class="time">
             <div class="take-off col-sm-4">
               <div class="icon"><i class="soap-icon-plane-right yellow-color"></i></div>
                   <div>
                        <span class="skin-color">Take off</span><br /><?php echo $schedule->deptime ?>
                   </div>
               </div>
                    <div class="landing col-sm-4">
                       <div class="icon"><i class="soap-icon-plane-right yellow-color"></i></div>
                           <div>
                                 <span class="skin-color">landing</span><br /><?php echo $schedule->arrtime ?>
                            </div>
                        </div>
                             <div class="total-time col-sm-4">
                                 <div class="icon"><i class="soap-icon-clock yellow-color"></i></div>
                                   <div>
                                         <span class="skin-color">total time</span><br /><?php echo $schedule->flighttime ?>
                                   </div>
                                </div>
                          </div>
               </div>
    </div>
 </td>

 <td>
      <div   class="details col-xs-9  col-sm-10">
            <div  style="width: 90%;"class="details-wrapper">
                  <div class="first-row">                    
                       <div class="action">
                           <?php
                                  # Don't allow overlapping bids and a bid exists
                                  if(Config::Get('DISABLE_SCHED_ON_BID') == true && $schedule->bidid != 0) {
                           ?>
                              <a id="<?php echo $schedule->id; ?>" class="addbid"
                                        href="<?php echo actionurl('/schedules/addbid/?id='.$schedule->id);?>"class="button btn-mini                                           sky-blue1 full-width"></a>
                            <?php
                                } else {
                                  if(Auth::LoggedIn()) {
                             ?>
                             <a id="<?php echo $schedule->id; ?>" class="addbid button btn-mini sky-blue1 full-width"
                                href="<?php echo url('/schedules/addbid');?>">Add to Bid</a>
                            <?php   
                               }
                               } 
                            ?>
				   </div>
               </div>
                 <div class="second-row">
                    <div class="action">
                       <a href="<?php echo url('/schedules/details/'.$schedule->id);?>" class="button btn-mini  red">DETAILS</a>
     </div>
</div>
</div>
</td>
</tr>
   <?php
           /* END OF ONE TABLE ROW */
            }
     ?>
                </article>
  </tbody>
</table>						 

</div>
</div>
</div>
</div>
</div>
</section> 

Link to comment
Share on other sites

  • Members

if you are doing it with javascript like above you still will be loading all the records

you will need to set a mysql limit look at this example

$sql = "SELECT * FROM Orders LIMIT 30";

and then you will need to continue from where you stopped with

$sql = "SELECT * FROM Orders LIMIT 10 OFFSET 15";

have a look at this website

http://www.w3schools.com/php/php_mysql_select_limit.asp

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...