I was able to export the data to the array variable in the model file.
My Model
Code:
public function o_get2($data) {
$array = [];
for ($i = 0; $i < count($data); $i++) {
$this->db->where('varyasyon_id', $data[$i]);
$query = $this->db->get('opsiyonlar');
foreach($query->result() as $key => $row)
{
$array[$i][$key] = $row->opsiyon_baslik;
}
}
return print_r($array);
}
Print:
Array ( [0] => Array ( [0] => S [1] => M [2] => L [3] => XL ) [1] => Array ( [0] => Kırmızı [1] => Sarı [2] => Yeşil ) )
but i can't print it on controller.
Controller???
Code:
public function o_getir() {
$data = $this->input->post('opts');
$this->varyasyonlar_model->o_get2($data);
foreach ($data as $key => $row) {
$output['opsiyon_baslik'][$key] = $row->opsiyon_baslik;
}
echo json_encode($output);
}