PHP foreach loop is taking time to load thousands of table data in Google Chrome -


on page have 8500 employees shown in table data in form of <tr> , <td>. name of employees shown checkbox in front of each name of employee. when click on checkboxes insert employees data (employee name , employee id) session.

everything working fine problem when click on check checkbox employees checkboxes selected there button named "view selected". on click of button want selected employees. when user click on button new child window opened selected employee data in form table row , data.

i doing using session have created on click of employees checkboxes.

everything working on mozilla firefox when check of google chrome not working , getting browser message killpages or wait. loader image of chrome shown data not loading.

my new child window page code reading session , running for-each loop print data in form of table data.

    <?php require_once("../../includes/global.php");     $sessionname = rq('sessionname');     $employees = $session->read($sessionname);     ?>     <script type="text/javascript" src="<?php echo siteurl_page; ?     >configuration/js/attendancepolicy.js"></script>      <div style="width: 100%;">   <?php if(strpos($sessionname, 'location') !== false) {?>   <h3 style="padding-left:10px;">view <?php echo location_display_name?>s</h3>   <?php } else {?>   <h3 style="padding-left:10px;">view <?php echo     us(substr(str_replace('ot_','',$sessionname), 0, -3))?></h3>   <?php }?>   <?php                   $totalemployees = $session->check($sessionname) ? (int)count($session->read($sessionname)) : 0;                 ?>   <form id="updateemployeesform" name="updateemployeesform" method="post"   action="saveattendancepolicy.php">     <input type="hidden" name="hidaction" value="addnewpolicy_step3" />     <input type="hidden" name="sessionname" id="sessionname" value="<?php echo $sessionname?>" />     <?php  $styletab = ''; $style=''; if($totalemployees > 30){     $styletab = 'border-bottom: none;';     $style = 'overflow:auto; height: 230px !important; border-bottom: 4px solid #2c90d3;'; } //for on time policy $functionsuffix = ''; if($sessionname == 'ot_locations_cb' || $sessionname == 'ot_divisions_cb' || $sessionname == 'ot_departments_cb' || $sessionname == 'ot_employees_cb') {     $functionsuffix = 'overtimepolicy'; }  $where  = rq('where'); $employeeloadpage = ($sessionname == 'ot_employees_cb')?'otpolicy_ajax':''; if(stripos($sessionname, 'employee') > -1) {     $js = "closeclildwindow('', 'employeediv', 'yes','".$employeeloadpage."');"; } else if(stripos($sessionname, 'location') > -1) {     $js = "searchpolicyspecificnew('', 'locations', 'locationdiv', {'session':'yes'},'".$functionsuffix."'); updatechildpolicynew('".$sessionname."', 'yes','".$functionsuffix."');"; } else if(stripos($sessionname, 'division') > -1) {     $js = "searchpolicyspecificnew('', 'divisions', 'divisiondiv', {'session':'yes'},'".$functionsuffix."'); updatechilddepartmentpolicynew('".$sessionname."', 'locations_cb', 'yes','".$functionsuffix."');"; } else if(stripos($sessionname, 'department') > -1) {     $js = "searchpolicyspecificnew('', 'departments', 'departmentdiv', {'session':'yes'},'".$functionsuffix."'); updatechildjobtitlepolicy('".$sessionname."', 'divisions_cb', 'locations_cb', '','".$functionsuffix."');"; }  if($where == 'viewemp') {     if($sessionname == 'ot_employees_cb') {         $js="getselectedemployeesnew('ot');";     } else {         $js="getselectedemployeesnew();";     } } ?>     <div class="totalrecord" style="float:right; width:99%;text-align:right; margin-top: 5px;">       <label>total record(s) :<?php echo $totalemployees ?></label>     </div>     <div style="margin: 0 2% 0 2%; width: 96%;" class="div_row">       <table cellpadding="0" border="0" cellspacing="0" width="100%" class="bdrtable" style="border-bottom: 0px;">         <thead>           <tr>             <th align="left" scope="col" colspan="5"> <input type="checkbox" name="viewcheckallname" id="viewcheckallname" <?php if($totalemployees > 0) {?> checked="checked"<?php }?> class="class_parent_pop" onclick="sessioncheckbox('class_parent_pop', '<?php echo $sessionname?>_pop', 'parent', this);"   />               check </th>           </tr>         </thead>       </table>     </div>     <div style="margin-bottom: 2%; margin-left: 2%; margin-right: 2%; width:96%;<?php echo $style;?>" class="div_row">       <table cellpadding="0" border="0" cellspacing="0" width="100%" class="bdrtable" style="<?php echo $styletab?>">         <?php if($totalemployees > 0) { ?>         <tr>           <?php $i=1;                      foreach($employees $key=>$employeearr) {                              ?>           <td align="left" width="33%"><?php echo $i; ?> </td>           <?php                          if($i%3 == 0 && $i != $totalemployees) {                             echo '</tr><tr>';                         }                     $i++;                      }                                if($totalemployees%3 != 0) {                                                         ($x=($totalemployees%3); $x < 3; $x++) {                                                                         echo '<td align="left" width="33%">&nbsp;</td>';                         }                     }                 ?>         </tr>         <?php }else{ ?>         <tr>           <td colspan="3" align="center"><?php echo "no data found"; ?></td>         </tr>         <?php }?>       </table>     </div>     <div class="clear"></div>     <div class="div_row" style="text-align: right; width: 96%; margin:0 2%;">       <?php if($totalemployees > 0) {?>       <input type="button" name="updateemp" id="updateemp" value="update" class="submit" onclick="sessioncheckboxpopupupdate('<?php echo $sessionname?>_pop', '<?php echo $sessionname?>');<?php echo $js; ?>" />       <?php } ?>       <input type="button" name="cancel" id="cancel" value="cancel" class="submit" onclick="javascript:window.close();" />     </div>   </form> 

it may not foreach loop slow, 8500 number of data load, might want page results.

why don't try same query using phpmyadmin , see time taken.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -