• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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) {


View looks like this:
 <?php foreach ($users as $user): ?>
                        <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>
                            <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>
                <?php endforeach; ?>

Nothing in the model

Im getting a 404 on the click of the button

I would love some help as im pretty stuck



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 !!!

Have you set up a new route in config/routes.php?

PHP Code:
     * delete_user ()
     * --------------------------------------------------------------------
     * @access    public
     * @param    $id
public function delete_user($id)
$this->db->delete('users', array('id' => $id));
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.