php version 5.3.1 with codeigniter 2.0.2
help me, i have errors like this :
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object and Invalid argument supplied for foreach()
Filename: controllers/login.php
Line Number: 20
Controller
parent::__construct();
$this->load->model('option_m');
$option = $this->option_m->get_by(array('nama_opsi' => 'store_option'));
foreach (unserialize($option->value_opsi) as $key => $val) {
$this->data->$key = $val;
}
$this->template->use_asset()->set_judul('Form Login')->set_css('login');
$this->data->metadata = $this->template->get_metadata();
$this->data->judul = $this->template->get_judul();
}
in the sublime text, line number 20 is, but im not sure:
foreach (unserialize($option->value_opsi) as $key => $val) {
$this->data->$key = $val;