I stored some data to an array using this code
$this->data[\'result\'] = $this->mymodel->search($keyword);
when I print my result
If your model returns only one record, you can use this shortcut:
$pro_id = $this->data['result'][0]->product_id;
Try this:
$pro_id = []; foreach($this->data['result'] as $key => $val){ $pro_id[] = $val->product_id; } print_r($pro_id);