Kelvin Kelvin - 3 months ago 5x
PHP Question

how to get all data in array for where clause in codeigniter

this is my

which return array :

array(5) {
string(1) "1"
string(1) "5"
string(1) "9"
string(2) "13"
string(2) "17"

that array is

i need to get that
for where clause, i have tried this to get all the value :

foreach($cuisines_category as $key => $value){
$cuisines_category_all = $this->Control_panel_m->m_get_cuisines_name_by_id($value);

but its only returing 1 value. I need to return all of them

guys can you help me how to get it?

thank you (:

p.s the long of array cant be change


You overwrite the same variable $cuisines_category_all in each iteration of the loop so it will only contain the value from last iteration

Perhaps you want it to be an array in which case do

foreach($cuisines_category as $key => $value){          
      $cuisines_category_all[] = $this->Control_panel_m->m_get_cuisines_name_by_id($value);