<div class="active tab-content">
	<div class="active tab-pane" id="Admin">
		<form method="post" name='UpdateData'>  
			<div class="row">
				<div class="col-md-12">
					<?php 
					include'config.php'; 
					$output = '';  
					$sql = "SELECT * FROM tbl_features group by fnid ORDER BY id DESC  ";  
					$result = mysqli_query($con, $sql);  
					$id=1;

					?>
					<table class="table table-bordered">  
						<tr class="danger">  
							<th width="5%">SN</th>
							<th>FnId</th>
							<th width="21%">Function Name</th>
							<th>Discription</th>
							<th width="20%">Version</th>
							<th width="5%">Status</th>
						</tr>  
						<?php  
						while($row = mysqli_fetch_array($result))  
						{  
							?>  
							<tr> 
								<td><?php echo $id++ ; ?></td> 
								<td><?php echo $row["fnid"]; ?></td>                     
								<td><?php echo $row["fname"]; ?></td>                     
								<td><?php echo $row["disc"]; ?></td>
								<td><?php 

								$i=0;
								$sql1 = "SELECT * FROM tbl_features Where fnid ='".$row["fnid"]."'";
								$result1 = mysqli_query($con, $sql1);
								while($row1 = mysqli_fetch_assoc($result1)) {
												// $demo2= substr($_POST['cuname'], 0,4); 
									$demo3=$_POST['cuname'];
									$b=explode('-', $_POST['cuname']);
									$sql12 = "SELECT * FROM tbl_permission WHERE desi= '".$b[1]."' and cType='".$b[0]."'";
									$result12 = mysqli_query($con, $sql12);
									$row12 = mysqli_fetch_assoc($result12);


									$j= $i+1; 
									$demo1= substr($row12[$row["fnid"]], 0,1);  

									$v='V'.$row1['version'];
									if ($row1['version']==$demo1) {
										$status='checked';
									}
									else
									{
										$status='';
									}
									?>
									<?php echo $v; ?>
									<label class="switch `-inline">
										<input 
										data-index="<?php echo $row1["version"]; ?>"
										data-index2="<?php echo $_POST['cuname']; ?>"
										data-index3="<?php echo $_POST['user']; ?>" 
										data-index4="<?php echo $row1["fnid"]; ?>"
										class="status_data" type="checkbox" class="chk" <?php echo $status; ?>>
										<span class="slider round"></span>
									</label>
									<?php

								}
								if ($demo1==0) {
									$status='checked';
								}
								else{
									$status='';
								}
								?>

							</td>  
							<td><label class="switch `-inline">
								<input 
								data-index="0"
								data-index2="<?php echo $_POST['cuname']; ?>"
								data-index3="<?php echo $_POST['user']; ?>" 
								data-index4="<?php echo $row["fnid"]; ?>"
								class="status_data" type="checkbox" class="chk" <?php echo $status; ?>>
								<span class="slider round"></span>
							</label></td>
						</tr>  
						<?php  
					}  
					?>  
				</table>
			</div>
		</div>	
	</form>
</div>
</div>