50e59f3e9c4e5d94efdbea6bc00b2e2c I have three tables, and I'm going to show the third table. What I want to know is how to delete each entry from it? As, the first and the second tables ids are fetched and inserted in the third one. As in, I have my model as follows.

public function delhr($Interior_house_id, $Interior_room_id)
    {
    //echo '<pre>'; print_r($Interior_house_id);
    $abc= implode(',', array('Interior_house_id'));
    print_r($abc);
    print_r($Interior_room_id); exit;
    $this->db->where(Interior_house_id,$Interior_house_id);
    $this->db->where(Interior_room_id,$Interior_room_id);
    $data = $this->db->delete('house_room');    
    return $data;
    }

The following is in my controller file.

public function delhr($Interior_house_id,$Interior_room_id)
    {
        //print_r($interior_house_room_id);
        $delete = $this->admin_model->delhr($Interior_house_id, $Interior_room_id);
        //echo '<pre>'; print_r($delete);
        if($delete) redirect('gethr');
    }

Please help me as to how to delete them. As in I have to use both ids to delete. a single record.

Recommended Answers

All 2 Replies

First argument of where() method is a string, at the moment it seems to be a constant, so change them to:

$this->db->where('Interior_house_id', $Interior_house_id);
$this->db->where('Interior_room_id', $Interior_room_id);

Done, but it still is showing some issues. I have taken a third id. I'll mark this as solved and put it in another one. It's a bit of a mess. Thanks for taking time to help me out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.