File: //proc/thread-self/cwd/school-admin/student-list.php
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
include('header.php');
?>
<link href="assets/extra-libs/datatables.net-bs4/css/dataTables.bootstrap4.css" rel="stylesheet">
<?php
include('sidebar.php');
include_once('../wp-config.php');
$school_id = $_SESSION['user_id'];
$studentList = "SELECT ss.name, ss.mobile, ss.email, ss.dob,ps.state_name,pc.city_name FROM wp_psy_school_student ss LEFT JOIN wp_psy_states as ps ON ps.state_id = ss.state_id
LEFT JOIN wp_psy_city as pc ON pc.city_id = ss.city_id WHERE ss.school_id = '$school_id'";
$allStudent = $wpdb->get_results($studentList);
?>
<div class="page-wrapper">
<div class="page-breadcrumb">
<div class="row">
<div class="col-12 align-self-center">
<h4 class="page-title text-truncate text-dark font-weight-medium mb-1">Student List</h4>
<div class="d-flex align-items-center">
<nav aria-label="breadcrumb">
<ol class="breadcrumb m-0 p-0">
<li class="breadcrumb-item"><a href="dashboard" class="text-muted">Home</a></li>
<li class="breadcrumb-item text-muted active" aria-current="page">Student List</li>
</ol>
</nav>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<!-- ============================================================== -->
<!-- Start Page Content -->
<!-- ============================================================== -->
<!-- basic table -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<h4 class="card-title">Student List</h4>
<div class="table-responsive">
<table id="zero_config" class="table table-striped table-bordered no-wrap">
<thead>
<tr>
<th>S.No</th>
<th>Name</th>
<th>Mobile</th>
<th>Email</th>
<th>Date of birth</th>
<th>State</th>
<th>City</th>
</tr>
</thead>
<tbody>
<?php
$a=1;
foreach($allStudent as $Student){ ?>
<tr>
<td><?php echo $a; ?></td>
<td><?php echo $Student->name; ?></td>
<td><?php echo $Student->mobile; ?></td>
<td><?php echo $Student->email; ?></td>
<td><?php echo date('d-M-Y',strtotime($Student->dob)); ?></td>
<td><?php echo $Student->state_name; ?></td>
<td><?php echo $Student->city_name; ?></td>
</tr>
<?php $a++; } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
include('footer.php');
?>
<!--This page plugins -->
<script src="assets/extra-libs/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="dist/js/pages/datatable/datatable-basic.init.js"></script>
<script type="text/javascript">
function validateForm() {
var x = document.forms["myForm"]["fname"].value;
if (x == "") {
alert("Name must be filled out");
return false;
}
}
function getState(sel) {
$('#citvselect').hide();
$.ajax({
url: "backend/get_cities.php?state_id=" + sel.value,
cache: false,
success: function(html) {
$("#cityDIV").append(html);
}
});
}
</script>