Delete using codeigniter
To see the display page code click here.
Controller code for delete :-
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Cnt extends CI_Controller {
public function delete_data(){
$del_id=$this->input->get('del');
$resp=$this->Model->delete_data('emp1',$del_id);
echo "<script>alert('$resp');</script>";
$this->display_view();
}
}
Model code for Delete :-
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Model extends CI_Model {
public function delete_data($tbl,$del_id)
{
$this->db->where('emp_id',$del_id);
$this->db->delete('emp1');
return "Delete Record Successfully";
}
}
Comments
Post a Comment