<?php include("db.php"); ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="bootstrap-4.6.2-dist/css/bootstrap.min.css">

</head>
<body>

  <div class="container">
    <div class="row">
      
        <div class="col-md-3"</div>
        <div class="col-md-5">
          
        <p style="font-size:13px; padding: bottom 70%;margin-bottom: 230%;"><b></b></p>
        <p><b> List of Student in the Hostel</b></p>
        <table class="table table-bordered " border="1" style="width:50px; padding: 22px;">
    <thead>
        <tr>
         <th>Student_id</th>   
        <th>Surname</th>
        <th>Othername</th>
        <th>Deparment</th>
        <th>Residential Address</th>
        <th>Address</th>
        <th>Name of Guardian</th>
        <th>Phone Number: Guardian</th>
        <th>Operations</th>
        <!-- <th>Delete</th> -->
        <!-- <th>Delete</th> -->
      

        </tr>
        </thead>
            <?php
            $sql= "select * from hostel_table";
            $result=mysqli_query($db,$sql);
            if($result){
                while($row=mysqli_fetch_assoc($result)){
                    $student_id=$row['student_id'];
                    $surname=$row['surname'];
                    $othernames=$row['othernames'];
                    $department_name=$row['department_name'];
                     $residential_address=$row['residential_address'];
                     $nameguardian=$row['nameguardian'];
                     $phoneall=$row['phoneall'];
                    $guardian=$row['guardian'];
                  
                echo'
                <tr>
                <td>'.$student_id.'</td>
                <td>'.$surname.'</td>
                <td>'.$othernames.'</td>
                <td>'.$department_name.'</td>
                <td>'.$residential_address.'</td>
                 <td>'.$nameguardian.'</td>
                
                <td>'.$phoneall.'</td>
                <td>'.$guardian.'</td>
                
                <td><button class="btn btn-primary" name="updateid"><a href="update.php?updateid='.$student_id.'" class="text-light">Edit</a></button><td>
               <td><button  class="btn btn-danger"><a href="delete.php?deleteid='.$student_id.'" class="text-light">Delete</a></button></td>
                </tr>
                ';

                }
            }
            ?>
        </table>
        </div>
        <div class="col-md-2"></div>

    </div>
  </div>   

</body>
</html>