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;
$data = array();
 while( $row = mysqli_fetch_array($result))  {
 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