I am trying to fetch some values from the database and I'm getting this error
A PHP Error was encountered
Severity: Notice
Message: Undefined index: name
Filename: views/pro_view.php
Line Number: 12
My controller:
$this->load->model('profile_model');
$data['profile_data'] = $this->profile_model->get_records();
$this->load->view('pro_view', $data);
Model:
function get_records()
{
$r = $this->uri->segment(3);
$query = $this->db->get_where('profile', array('id' => $r));
return $query->result();
}
View:
<input type="text" name="name" value="<?php echo $profile_data["name"] ?>" />
if I var_dump(($profile_data); I'm getting everything in an array.
I read other similar questions and their answers, no luck.