I written a simple function to delete data from the database but the delete query is not properly my code for the model is as follows:
function removedata()
{
$userid = $this->input->post('userid');
$this->db->where('userid', $userid);
$deldata = $this->db->delete('userbasic');
if ($deldata == true) {
echo "Data Removed Successfully";
} else {
echo "Deletion Failed";
}
}
I have loaded the database already and tried both the query i.e.
$this->db->where('userid',$userid);
$deldata=$this->db->delete('userbasic');
and
$deldata=$this->db->delete('userbasic',array('userid'=>$userid));
So please suggest me answer there is no error in result it also prints data removed successfully but still data is not deleting from the database...
the code seems fine. try to debug.
use this to print the query.
echo $this->db->last_query();
and then try execute that query in your phpmyadmin. and check weather it deletes your row.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With