<?php  

  session_start();
  set_time_limit(0);
  ini_set('max_execution_time', 0);
  // error_reporting(0);
   include("../db.php");
   include("../all_query.php");
		
 
   $start = $_REQUEST['start'];
	  
	  
	$customerQ = mysqli_query($conn,"select *from `customer`    limit $start, 2000 ");
	 
	 
     while($customerData = mysqli_fetch_assoc($customerQ))
	 {
		  $account_holder_id = $customerData['account_holder_id'];
		  
		  
		/*  $tU = mysqli_query($conn,"select *from `updates` where account_holder_id = $account_holder_id ");
		  
		  $total_updates = mysqli_num_rows($tU);
		  
		   
		  $tN = mysqli_query($conn,"select *from `updates` where account_holder_id = $account_holder_id and attempt_status = 'No Contact' ");
		  
		  $total_non_contact = mysqli_num_rows($tN);
		   
		   
		   $total_contact = $total_updates  - $total_non_contact;
		    
		   */
		    
		   
		   
		//   mysqli_query($conn,"update `customer` set total_updates = $total_updates , total_non_contact = $total_non_contact , total_contact = $total_contact  where account_holder_id = $account_holder_id ");
		   
		   
		   $pQ = mysqli_query($conn,"select *from `updates` where account_holder_id = $account_holder_id and attempt_status = 'Contact P' ");
		   $total_contact_p = mysqli_num_rows($pQ);
		   
		   $nQ = mysqli_query($conn,"select *from `updates` where account_holder_id = $account_holder_id and attempt_status = 'Contact N' ");
		   $total_contact_n = mysqli_num_rows($nQ);
		    
		   
		   
		   mysqli_query($conn,"update `customer` set total_contact_p = $total_contact_p , total_contact_n = $total_contact_n  where account_holder_id = $account_holder_id ");
		   
		   
		  
		  echo "<br/>******* $account_holder_id  :  Total: $total_updates **************************<br/>";
		  
		  
		   
		  
		  
		  
	  }
	  
	  
	  
	  
	  
	  
	    
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	   
 

 
  ?>