<?php
ob_start();
require_once './configs/webconfig.php';
require_once './utility/common_model.php';

require_once './controller/admin_controller.php';

$MyPdodb = new MyPDO();	

		$MyPdodb->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('MyPDOStatement'));		
		
		
		$sql = "SELECT *from hi_members order by id asc"; 
		
				$stm  = $MyPdodb->prepare($sql);      		
				$stm->execute(array($start,$limit));
				$results = $stm->fetchAll(PDO::FETCH_CLASS);
				
				
				
				$exportData = $results;
?>

<?php
	$totalHours =0;
	if(count($exportData)> 0) {
		foreach ($exportData as $project) { 	
			$totalHours += 	$project->hours;	
		}
	}
?>
    <table class="" width="100%" border="0">	                
                  <?php  if(count($exportData)> 0) {?>   
                 
                                 
      				<tr>
                    <td align="center" valign="top">                         
                        <table class="bordered-table zebra-striped dataTable" width="100%" id="datagrid">                        
                         <thead>
                          <tr>                            
                            <th align="left"><strong>Name</strong></th>
							<th align="left"><strong>Address</strong></th>
							<th align="left"><strong>City</strong></th>
							<th align="left"><strong>Mobile</strong></th>
                            <th align="left"><strong>User Name</strong></th>
							
                            <th align="left"><strong>Password</strong></th>
							
                          </tr>
                        </thead>                     
                         <tbody>
						   <?php				  
                           $i=$start;						   
                          foreach ($exportData as $project) { 							  
                            $i++;				  							              
                          ?>
						  <tr>
						  </tr>
						  <tr>
						  </tr>
                          <tr>
                             <td align="left"><?php echo $project->fullname?></td>
							 <td align="left"><?php echo $project->address1." ".$project->address2?></td>
							 <td align="left"><?php echo $project->city?></td>
							 <td align="left"><?php echo $project->mobile?></td>
                             <td align="left"><?php echo $project->username?></td>                             
                             <td align="left"><?php echo $project->password?></td>
							 
							 
							 
							
                          </tr>                                             
                          <?php
                           }
                          ?>   
                                     
                      </tbody>
                    </table>
                   
        </td>
                </tr>                 
                  <?php  }else{ ?>
                  <tr >
                    <td align="center">
                         <div class="col-lg-6 alert alert-danger" style="clear:right; float:none">
                            No records found.
                         </div>   
                    </td>
                  </tr>
                 <?php } ?>                  
              </table>   
<?php
$filename = "JPCMemberUsernameList-".date("dmY").".xls";
header( "Content-Type: application/vnd.ms-excel" );
header("Content-Disposition: attachment; filename=$filename");
header("Pragma: no-cache");
header("Expires: 0");
ob_flush();
?>