Welcome Guest, Not a member yet? Register   Sign In
Message: Undefined variable: rows ?
#6

[eluser]LuckyFella73[/eluser]
Just a hint:
If your model method expects only one row as result it's
easier to just return like this:
Code:
if ($query->num_rows() > 0)
{
   return $query->row();
}
Look at (section ROW):
http://ellislab.com/codeigniter/user-gui...sults.html


And: if you pass data to your view you better do this:
Code:
$data['rows'] = $this->data_model->getAll();

instead of:
Code:
$this->data['rows'] = $this->data_model->getAll();

If you assign data to $this->whatever the values are available
in your views anyway (without the need to pass them).


Would be easier to find your error if you post both views
and the actual controller code.
But I guess its like Aken allready said:
you have to pass the values to you midnav:
Code:
function show_user()
{
$data_midnav['rows'] = $this->data_model->getAll();
$data['midnav'] = $this->load->view('data_model_test', $data_midnav, TRUE);

$this->load->view('front_page', $data);
}
// in view front_page.php you can echo $midnav then


Messages In This Thread
Message: Undefined variable: rows ? - by El Forum - 01-25-2012, 12:14 AM
Message: Undefined variable: rows ? - by El Forum - 01-25-2012, 12:37 AM
Message: Undefined variable: rows ? - by El Forum - 01-25-2012, 01:53 AM
Message: Undefined variable: rows ? - by El Forum - 01-25-2012, 03:11 AM
Message: Undefined variable: rows ? - by El Forum - 01-25-2012, 03:45 AM
Message: Undefined variable: rows ? - by El Forum - 01-25-2012, 03:54 AM
Message: Undefined variable: rows ? - by El Forum - 01-25-2012, 04:10 AM
Message: Undefined variable: rows ? - by El Forum - 01-25-2012, 04:16 AM
Message: Undefined variable: rows ? - by El Forum - 01-25-2012, 04:26 AM
Message: Undefined variable: rows ? - by El Forum - 01-25-2012, 04:36 AM
Message: Undefined variable: rows ? - by El Forum - 01-25-2012, 04:40 AM
Message: Undefined variable: rows ? - by El Forum - 01-25-2012, 04:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB