<?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>SN</th>
    <th>F Id</th>
    <th>Parent</th>
    <th width="21%">Function Name</th>
    <th>Discription</th>
    <th>Reg. date</th>
    <th>File Name</th>
    <th>Icon</th>
    <th>Version</th>
    <th>Action
    </th>   
  </tr>  
  <?php  
  while($row = mysqli_fetch_array($result))  
    {   $sql1 = "SELECT * FROM tbl_features Where fnid ='".$row["fnid"]."'";
  $result11 = mysqli_query($con, $sql1);
  $result1 = mysqli_query($con, $sql1);
  $result1111 = mysqli_query($con, $sql1);

  ?>  
  <tr> 
    <td><?php echo $id++ ?></td> 
    <td><?php echo $row["fnid"]; ?></td>                     
    <td><?php 
    while($row1111 = mysqli_fetch_assoc($result1111)) {
      $sql11 = "SELECT * FROM tbl_features Where id ='".$row1111["parent"]."'";
      $result111 = mysqli_query($con, $sql11);
      while($row111 = mysqli_fetch_assoc($result111)) { echo $row111["fnid"]."<br>"; } 
    }
    ?></td>                     
    <td><?php echo $row["fname"]; ?></td>                     
    <td><?php echo $row["disc"]; ?></td>
    <td><?php echo $row["date"]; ?></td>
    <td><?php 
    while($row11 = mysqli_fetch_assoc($result11)) {
     echo $row11["file_name"]."<br>"; }?></td>
     <td><?php echo $row["icon"]; ?></td>
     <td><?php 
     
     while($row1 = mysqli_fetch_assoc($result1)) {
      $v='V'.$row1['version'];
      if ($row1['status']=='0') {
        $status='checked';
      }
      else if ($row1['status']=='1') {
        $status='';
      }
      else
      {
        $status='disabled';
      }
      ?>
      <center>
        <?php echo $v; ?><label class="switch checkbox-inline">
          <input data-index="<?php echo $row1["id"]; ?>" class="status_data" type="checkbox" class="chk" <?php echo $status; ?>>
          <span class="slider round"></span>
        </label>
      </center>
      <?php
    }
    ?>
  </td>
  <td>
    <input type="button" name="edit" value="Edit" id="<?php echo $row["id"]; ?>" data-index="<?php echo $row["fnid"]; ?>" class="btn btn-success btn-xs edit_data" />&nbsp;&nbsp;
    <!-- <input type="button" name="delete" value="Delete" id="<?php echo $row["fnid"]; ?>" class="btn btn-danger btn-xs delete" />&nbsp;&nbsp;  -->
  </td>  
</tr>  
<?php  
}  
?>  
</table>




