 
   <?php 
   error_reporting(0);
   ini_set('display_errors', 0);

    $user_id=$_GET['id'];
    $i = 1;
    $selected = mysqli_query($conn,"SELECT *  FROm  teacher_srms,class_srms WHERE teacher_srms.class_id=class_srms.class_id AND  teacher_srms.user_id='$user_id';");
    $row2 = mysqli_fetch_array($selected);   
    $reg_number=$row2['teacher_roll_no'];


    if(isset($_GET['del']))
      {
      $id= $_GET['del']; 
      $sql =mysqli_query($conn,"DELETE FROM `teacher_course` WHERE teacher_exam_id = $id");
      $sql1 = mysqli_fetch_array($sql);
      if ($sql1) {
        header('location:admin.php?page=view_profile&id='.$user_id.'');
      }
     
      }  

    ?> 
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header" style="background: linear-gradient(#bbd5f1,#f4f2f2,#bbd5f1);">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <a><strong>Teacher Profile</strong></a>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="#">Home</a></li> 
              <li class="breadcrumb-item active">Profile</li>
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section> 
    <br>
   <!-- Main content -->
    <section class="content">
      <div class="container-fluid"> 
                    <div class="card">
                     <div class="card-header">
                      <h3 class="card-title">Tutor Profile</h3> 
                         </div> 
                         <!-- /.card-header --> 
                        <div class="modal-body"> 
                          <div class="container">  
                              <div class="row"> 
                              <div class="col-md-4">

                                <!-- Profile Image -->

                                <div class="card card-primary card-outline"> 
                                  <div class="card-body box-profile"> 
                                    <div class="text-center">
                                      <img class="profile-user-img img-fluid img-circle"
                                           src="../<?php echo $row2['user_profile']; ?>"
                                           alt="User profile picture">
                                    </div>

                                    <h3 class="profile-username text-center"><?php echo $row2['teacher_roll_no']; ?></h3> 

                                    <ul class="list-group list-group-unbordered mb-3">
                                      <li class="list-group-item">
                                        <b>Name</b> <p class="float-right"><?php echo $row2['user_name']; ?></p>
                                      </li>
                                      <li class="list-group-item">
                                        <b>Mobile</b> <p class="float-right"><?php echo $row2['user_contact_no']; ?></p>
                                      </li>
                                       
                                      <li class="list-group-item">
                                        <b>Email</b> <p class="float-right"><?php echo $row2['user_email']; ?></p>
                                      </li>
                                    </ul> 
                                  </div>
                                  <!-- /.card-body -->
                                </div> 
                           
                              </div>
                              <!-- /.col -->
                              <div class="col-md-8">
                                <div class="card card-primary card-outline"">
                                  <div class="card-header p-2">
                                    <ul class="nav nav-pills">  
                                      <li class="nav-item"><a class="nav-link" href="#settings" data-toggle="tab">Tutor Course</a></li>
                                      <hr>
                                    </ul>
                                  </div><!-- /.card-header -->
                                  <div class="card-body">
                                    <div class="tab-content">  
                                       <div class="table-responsive">
                                        <div class="card-body p-0">
                                          <table class="table table-striped display table-bordered">
                                            <thead>
                                              <tr>
                                                <th style="width: 10px">#</th>
                                                <th>SUBJECT NAME</th> 
                                                <th>CLASS</th>  
                                              </tr>
                                            </thead>
                                            <tbody>
                                               <?php  
                                                $i = 1;
                                                  $selected2 = mysqli_query($conn,"SELECT * FROM `general_subject`,`class_srms`,teacher_course WHERE teacher_course.class_id=class_srms.class_id AND general_subject.sub_id=teacher_course.code AND teacher_course.teacher_roll_no='$reg_number';");
                                                 while($row = mysqli_fetch_array($selected2)){  
                                                ?> 
                                              <tr>
                                                <td><?php echo $i++ ?></td>
                                                <td><?php echo $row['subject_name']; ?></td> 
                                                <td><?php echo $row['class_name']; ?></td>
                                                <td> <a href="admin.php?page=view_profile&del=<?php echo $row['teacher_exam_id']; ?>" onclick="return confirm('Are you sure you want to delete?');" class="btn btn-danger btn-flat delete_student">
                                                    <i class="fas fa-trash"></i>
                                                  </a> 
                                                </td>  
                                              </tr>
                                              <?php } ?>
                                            </tbody> 
                                          </table>
                                        </div>
                                      </div>
                                      <!-- /.tab-pane -->
                                    </div>
                                    <!-- /.tab-content -->
                                  </div><!-- /.card-body -->
                                </div>
                                <!-- /.card -->
                              </div> 
                              <!-- /.col -->
                            </div> 
                           </div>
                            </div>
                            <div class="modal-footer justify-content-between">
                               <a class="btn btn-default" href="admin.php?page=teacher">Back </a>  
                            </div> 
                         </div> <!-- end card body-->
                        
                <!-- /.tab-content -->
        </div>

      </section>
    <!-- /.content -->
  </div>
  </div>
  <script src="../stp_con/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../stp_con/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- DataTables  & Plugins -->
<script src="../stp_con/datatables/jquery.dataTables.min.js"></script>
<script src="../stp_con/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="../stp_con/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="../stp_con/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<script src="../stp_con/datatables-buttons/js/dataTables.buttons.min.js"></script>
<script src="../stp_con/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
<script src="../stp_con/jszip/jszip.min.js"></script> 
<script src="../stp_con/pdfmake/pdfmake.min.js"></script>
<script src="../stp_con/pdfmake/vfs_fonts.js"></script> 
<script src="../stp_con/datatables-buttons/js/buttons.html5.min.js"></script>
<script src="../stp_con/datatables-buttons/js/buttons.print.min.js"></script>
<script src="../stp_con/datatables-buttons/js/buttons.colVis.min.js"></script>
 
<script src="../assets/js/adminlte.min.js"></script> 
<script>
  $(function () {
    
    $('#example2').DataTable({
      "paging": false,
      "lengthChange": false,
      "searching": false,
      "ordering": false,
      "info": false,
      "autoWidth": false,
      "responsive": true,
    });
     $('#example3').DataTable({
      "paging": false,
      "lengthChange": false,
      "searching": false,
      "ordering": false,
      "info": false,
      "autoWidth": false,
      "responsive": true,
    });
      $('#example4').DataTable({
      "paging": false,
      "lengthChange": false,
      "searching": false,
      "ordering": false,
      "info": false,
      "autoWidth": false,
      "responsive": true,
    });
  });
</script>  
 