[eluser]jenie_net[/eluser]
Hi all, i'm new.
I've a strange error, probably done by mine in-experience.
I've got a model
Code:
<?php
class Contacts_model extends Model {
function Contacts_model()
{
parent::Model();
}
function getContactDetails($id){
$this->db->where('c_id', $id);
$rset=$this->db->get('contacts');
return $rset->result(); // or should i return $rset? or $rset->result_array();
}
}
?>
A simple controller:
Code:
<?php
class Welcome extends Controller {
function Welcome()
{
parent::Controller();
}
function details($id)
{
$this->_default();
$data['det'] = $this->Contacts_model->getContactDetails($id);
$this->load->view('details',$data);
$this->_footer();
}
function _default(){
$h_data['base'] = $this->config->item('base_url');
$h_data['css'] = $this->config->item('css');
$this->load->model('Contacts_model');
$this->load->view('header',$h_data);
}
function _footer(){
$this->load->view('footer');
}
}
?>
How can i print in a view the values in $data['det'] ?
I tried with :
Code:
<?php print_r($det); ?>
and is OK, but if i try to retrieve values
in this way
Code:
<?php echo $det['location']; ?>
I've got this error:
Quote:#
A PHP Error was encountered
Severity: Notice
Message: Undefined index: location <--- why undefined index???
Filename: views/details.php
Line Number: 11
Thanks in advance.
Stef