[eluser]Unknown[/eluser]
Can you please piont at my mistake. First of all I will write my code.
In my model I have:
Code:
class Left_model extends CI_Model
{
public function __construct()
{
parent::__construct();
}
public function left2_narrow_model($cat)
{
$res = $this->db->where('narrow_cat', $cat)->count_all_results("NEW_materials");
return $res;
}
}
Controller:
Code:
class Left extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
public function left2_cont()
{
$this->load->model('attached/Left_model');
$res['res'] = $this->Left_model->left2_narrow_model(1);
$this->load->view('template/left2',$res);
$this->load->model('attached/Left_model');
$result['result'] = $this->Left_model->left2_narrow_model(2);
$this->load->view('template/left2',$result);
}
}
And view:
Code:
<p><?=$res;?></p>
<p><?=$result;?></p>
The problem is I have an error mistake:
Инициализирована ошибка PHP кода
Статус: Notice
Сообщение: Undefined variable: sql
Имя файла: template/left2.php
Номер строки: 2
Инициализирована ошибка PHP кода
Статус: Notice
Сообщение: Undefined variable: result
Имя файла: template/left2.php
Номер строки: 5
I can't understand where I made a mistake.