PHP - generate team based on seniority

I would like to generate team by their seniority based on the available members.
For example : I have 60 members. I want use all this 60 members as teams. Each team has one leader,one asst leader, and 8 members (1+1+8) .

$result = mysqli_query($con, "SELECT * FROM `members` WHERE ORDER BY DOJ,DOB");
$perteam =10;
$teamstart=1;
$teams=15;
$required=$perteam*$teams;
$data = array();
 while( $row = mysqli_fetch_array($result))  {
  $data[]=$row;
 }
 foreach($data as $fetch){
	 echo $fetch["empname"].'<br>';

}

I used the above code to fetch the members in seniority . Now I want to add another coumns Team and Designation as follows;

1.Peter - Team 1-Leader1
2.Robin - Team 2 - Leader2
… Likewise it should go…

How do I achieve this.

any lead…?

Sponsor our Newsletter | Privacy Policy | Terms of Service