I have my controller :: controller.php
which has a call to my model but I already know what id's I want to search for so what I want to know is how would I send that array to my model so that my model searches those and returns the result
example:
controller.php
foreach($value as $val){
$array[] = $val;
}
$search = $this->search_model->send_array($array);
search_model.php
public function send_array($array){
$this->db->where($array[index]);
//something like this
return $this->db->get($this->table);
}
the array that is being sent is the primary key of the table so I don't know how to get back that data.
in the database example my array is the value of the ID and I want to get back those rows in only one return within my model
if in the array there is (1,3,4) i should get back John, Terry, and Anna
return $this->db->get($this->table);
Database table:
ID NAME
1 John
2 Doe
3 Terry
4 Anna