Codeigniter get_where on active record
use this :
<?php public function load_parents () { $query = $this->db->get_where('checklist_items', array('checklist_id' => $checklist_id, 'parent_id' => $parent_id)); $result = $query->result_array (); return $result;}?>
Use
$query = $this->db->get_where('checklist_items', array('checklist_id' => $checklist_id, 'parent_id' => $parent_id));
Try using this code
public function load_parents () { $query = $this->db->get_where('checklist_items', array('checklist_id' => $checklist_id , 'parent_id' => $parent_id));$result = $query->result_array ();return $result;}
You can not use &&
in array.
It will automatically consider and
.
Another way is using where like
public function load_parents () { $query = $this->db ->where('checklist_id' => $checklist_id) ->where('parent_id' => $parent_id) ->get('checklist_items');$result = $query->result_array();return $result;}