public function Delete($request) { $dao = new ChatDAO(); $username = $request->get("username"); $query = "delete from login where username=?"; $dao->query($query, $username); $list = $dao->getUsers(); $ulist = json_encode($list); echo $ulist; }
<!-- <table class="table table-striped table-hover"> <thead> <tr> <th>Username</th> <th>Email</th> <th>Gender</th> <th>Gender</th> </tr> </thead> </table> --> <?php if (isset($_SESSION['login']) && $_SESSION['admin'] == 1) { echo ' <table class="table table-hover" id="tableList"> <thead class="text-center"> <tr> <th style="text-align:center">Username</th> <th style="text-align:center">Email</th> <th style="text-align:center">Gender</th> <th style="text-align:center">Admin</th> <th style="text-align:center">Actions</th> </tr> </thead>'; echo '<tbody id="users">'; $dao = new ChatDAO(); $users = $dao->getUsers(); foreach ($users as $user) { echo '<tr>'; echo "<td>{$user->username}</td>"; echo "<td>{$user->email}</td>"; $srcImg = ""; if ($user->gender == "female") { $srcImg = "img/femaleBunny2.jpg"; } else { $srcImg = "img/maleBunny2.jpg"; } // $user->gender echo "<td><img src={$srcImg} class='img-responsive img-rounded'></td>"; $admin = "Admin"; if ($user->admin == 1) { echo "<td>TRUE</td>";