[eluser]Unknown[/eluser]
Just a simple code to retrieve a single value from db. I can get it show by using echo $data in controller. When i try to echo it in view, there's nothing show.
Here's the error:
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: data
Filename: views/gx_display.php
Line Number: 22
Model:
Code:
function get_v()
{
return $this->db->where('ordering','1')->get('gx')->row()->menu_pic;
}
Controller:
Code:
public function index()
{
$data = '';
$data = $this->Gx_display_model->get_v();
$this->load->view('gx_display', $data);
}
View:
Code:
<img src="/img/<?php echo $data;?>" width="580" height="332" border="0" usemap="#Map" name="MAPA01" id="MAPA01">
So, where's the problem?
Thanks for advance!
- Mikanmaozi -