I'm trying to get data from one database with a condition where id equals to current logged in tenant (tenant_id),
$this->data['props'] = $this->property_m->get_by( array ('id' => $this->session->userdata['tanant_id'] ));
and then get some values from a field and save in an array,
if(count($this->data['props']) > 0){
$my_array = array();
foreach ($props as $prop){
$my_array['id'] = $prop->tenant_id;
}
}
First problem here - $my_array consists only 1 value. ( I need it to be multiple ) How can I do that ?
Second problem - I need to select data from another table which would look for data fulfilling the condition in that array, as,
$this->data['reports'] = $this->report_m->get_by($my_array);
which would say,
SELECT * FROM reports WHERE ('id = 1'); // or 2 or 3 (value from prop->tenant)
but I need it to be,
SELECT * FROM reports WHERE ('id = 1 OR id = 2 OR id = 3');
idevery iteration. 2.Where id IN ()