<? 
	session_start();
	$groupid = $_GET['gpid'];
	//echo "{$groupid}";
	include "../../Connections/connect_mysql.php";
	if($groupid){
		$sqle=" select * from group_tb where GroupID=" . $groupid . "; ";
		$resulte = mysql_query($sqle) or die(mysql_error());
		$recorde=mysql_fetch_array($resulte);
		$GroupName = $recorde['GroupName'];	
	}
?>

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script>
$(document).ready(function() {
	$('#groupteamtb').DataTable({
		"dom": '', //กำหนดส่วนหัวเอง
		"scrollY": '50vh', //"200px",
  		"scrollCollapse": true,
  		"paging": false
	});
	
});
</script>
</head>

<body>
	<div class="row">
    	<div id="rc1" class="col-md-12">
			<div id="a1" style="display:none;"><? echo "{$groupid}";  ?></div><? if($groupid){ echo " {$GroupName}"; } ?>
    	</div>
    </div>
    <div class="row">
    	<div id="rc2" class="col-md-12">
        	<div id="a2">
           <table id="groupteamtb" class="display cell-border compact row-border table table-striped table-bordered" cellspacing="0" width="100%">
          <thead>
              <tr>	
                  <th>ผู้ใช้งาน</th>
                  <th align="center">ลบ</th>
              </tr>
          </thead>
          
          <tbody>
         <?
			if($groupid){
			  $sqlet=" select * from groupteam_tb where groptGroupID=" . $groupid . "; ";
			  $resultet = mysql_query($sqlet) or die(mysql_error());
			  while($recordet=mysql_fetch_array($resultet)){
				  $groptID = $recordet['groptID'];
				  $groptUserID = $recordet['groptUserID'];
				  $groptGroupID = $recordet['groptGroupID'];
				  
				  $sqlug = " select * from user_tb where userid={$groptUserID}";
				  $resultug = mysql_query($sqlug) or die(mysql_error());
				  $recordug=mysql_fetch_array($resultug);
				  $usercode = $recordug['usercode']; 
				  $usernameth = $recordug['usernameth'];
				  $userlnameth = $recordug['userlnameth'];
		 ?>
         
          	<tr>	
                <td><?=$usercode?>,<?=$usernameth?> <?=$userlnameth?></td>
                <td align="center"><button type="button" class="btn btn-danger" onClick="javascript:delgropt(<?=$groptID?>,<?=$groptUserID?>);"><i class="fa fa-times"></i> ลบ</button></td>
            </tr>
         <?		
			  }
			}//while
		 ?>
          </tbody>
     </table>
            	
                
            </div>
        </div>
    </div>
</body>
</html>
<?
	mysql_close($c);
?>