<?php include("parent/callMe.php"); ?>
<?php  include("sessioncheck.php"); ?>

<?php


// getting all students strength of deleted/old schools
   	    
$sql = "SELECT branch_id,Branch_Name,old_branch_id from edu_delete_branch_data";

$students_data = $m->query($sql);

$count=1;
$total=0;

  foreach($students_data as $record){


  	  if($count<=50){
  		//break;
  	}

  	echo $record['Branch_Name']."======".$record['old_branch_id']."<br/>";

  	// getting data of students & inserting into backup table

	$m->where("branch_id", $record['old_branch_id']);
	$data=$m->get("eduportal_attendance_detail");
  	echo "records==".count($data)."<br/>";
  	
  	
  	$total+=count($data);


  	// now inserting to the backup talbe


		 foreach($data as $details){

	  	 	//$m->insert("eduportal_attendance_deleted_schools_data",$details);

	  	 }

  	  	//$m->where("branch_id", $record['old_branch_id']);
  		//$m->delete("eduportal_attendance_detail");
	

  	$count++;
  }


 echo "<br><br><br> Total Records: ".$total;


 ?>