Monday, 4 July 2022

Delete from database in Codeiginater 4

Function

 public function DelContact($field,$val)

    {       

         $db = new ContactModel();

         $db->where($field,$val)->delete();

       return redirect()->to(site_url('admin/contact'));

    }


Calling

<a href="<?php echo site_url('admin/DelContact/ID/123'); ?>" onclick="return confirm('Are you sure to delete this record')">


Next Topic

No comments:

Post a Comment