Deletes are not allowed unless they contain a "where" or "like" clause

codeigniter, mysql, php

Solution

Actually, CI `delete()` method returns `no where or limit` error on:

From the Source Code:

if (count($this->ar_where) == 0 && count($this->ar_wherein) == 0 && count($this->ar_like) == 0)
{
    if ($this->db_debug)
    {
        return $this->display_error('db_del_must_use_where');
    }

    return FALSE;
}

So I guess all you need to do is to swap your wheres with delete call:

$this->db->where('opp_id',$this->input->post('opp_id'));
$this->db->where_in('partner_id',$shortlistpartners);
$this->db->delete('shortlist_partners');   

Problem

My Query- `$shortlistpartners` is array ``` $this->db->delete('shortlist_partners'); $this->db->where('opp_id',$this->input->post('opp_id')); $this->db->where_in('partner_id',$shortlistpartners); ``` Deletes are not allowed unless they contain a "where" or "like" clause. error is coming,tell me any solution.

Original source