Active Record Delete does not work properly

I wrote a simple function to delete data from the database, but the delete request does not fit my code for the model 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 already downloaded the database and tried as a request, i.e.

 $this->db->where('userid',$userid);
  $deldata=$this->db->delete('userbasic');

and

$deldata=$this->db->delete('userbasic',array('userid'=>$userid));

Therefore, please offer me to answer that there is no error as a result, it also successfully deletes data, but still the data is not deleted from the database ...

+5
source share
1 answer

the code seems beautiful. try debugging.

use this to print a request.

echo $this->db->last_query();

and then try to execute this request in phpmyadmin. and check the weather, it will delete your line.

+1
source

All Articles