Deleting users in an admin panel |
Hey guys
New here not sure if this is the right place But I have a function that needs to delete users from an admin panel My contoller function is this: public function delete($id) { $this->admin_model->delete_user($id); redirect('/admin/users/'); } View looks like this: <?php foreach ($users as $user): ?> <tr> <td><?php echo $user['id']; ?></td> <td><?php echo $user['email']; ?></td> <td><?php echo $user['name']; ?></td> <td><?php echo $user['username']; ?></td> <td><?php echo $user['date_registered']; ?></td> <td> <a href="/admin/users/edit/<?php echo $user['id']; ?>" class="btn btn-primary btn-sm">Edit</a> <a href="/admin/users/delete/<?php echo $user['id']; ?>" class="btn btn-primary btn-sm">Delete</a> </td> </tr> <?php endforeach; ?> Model: Nothing in the model Im getting a 404 on the click of the button I would love some help as im pretty stuck Thanks
Hi,
As i see your code, you need to define delete_user($id) function in admin_model. feel free to ask if any query. Good Luck !!! PHP Code: /** What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |