Untitled
unknown
php
a year ago
3.5 kB
1
Indexable
Never
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>List Of Students</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> <style> .wrapper{ width: 1500px; margin: 0 auto; } table tr td:last-child{ width: 120px; } </style> <script> $(document).ready(function(){ $('[data-toggle="tooltip"]').tooltip(); }); </script> </head> <body> <div class="wrapper"> <div class="container-fluid"> <div class="row"> <div class="col-md-12"> <div class="mt-5 mb-3 clearfix"> <h2 class="pull-left">List of Users</h2> <a href="new_user.php" class="btn btn-success pull-right"><i class="fa fa-plus"></i>Add New User</a><br><br> </div> <?php include "connect_to_database.php"; $sql = "SELECT * FROM tbl_user LEFT JOIN tblcourse_level ON tbl_user.course_level=tblcourse_level.course_id LEFT JOIN tblyear_level ON tbl_user.year_level=tblyear_level.year_level_id"; if($result = mysqli_query($conn, $sql)){ if(mysqli_num_rows($result) > 0){ echo '<table class="table table-bordered table-striped">'; echo "<thead>"; echo "<tr>"; echo "<th>Student ID:</th>"; echo "<th>First Name:</th>"; echo "<th>Last Name:</th>"; echo "<th>Middle Name:</th>"; echo "<th>Email:</th>"; echo "<th>Year:</th>"; echo "<th>Course:</th>"; echo "<th>Actions:</th>"; echo "</tr>"; echo "</thead>"; echo "<tbody>"; while($row = mysqli_fetch_array($result)){ echo "<tr>"; echo "<td><a href='add_grade.php'>" . $row['student_number'] . "</a></td>"; echo "<td>" . $row['first_name'] . "</td>"; echo "<td>" . $row['last_name'] . "</td>"; echo "<td>" . $row['middle_name'] . "</td>"; echo "<td>" . $row['email'] . "</td>"; echo "<td>" . $row['year_level_name'] . "</td>"; echo "<td>" . $row['course_name'] . "</td>"; echo "<td>"; echo '<a href="view_student.php?student_id='. $row['student_id'] . '" class="mr-3" title="View Record" data-toggle="tooltip"><span class="fa fa-eye"></span></a>'; echo '<a href="delete_student.php?student_id='. $row['student_id'] .'&student_number='. $row['student_number'] .'" title="Delete Record" data-toggle="tooltip"><span class="fa fa-trash"></span></a>'; echo "</td>"; echo "</tr>"; } echo "</tbody>"; echo "</table>"; mysqli_free_result($result); } else { echo '<div class="alert alert-danger"><em>No records were found.</em></div>'; } } else { echo "Oops!<br>Something went wrong.<br>Please try again later."; } mysqli_close($conn); ?> </div> </div> </div> </div> </body> </html>