我试图从数据库中获取的一些价值观和我得到这个错误在读取值从数据库笨
一个PHP错误遇到
严重性:注意
消息:未定义指数:命名
文件名:观点/ pro_view.php
行号:12
我的控制器:
$this->load->model('profile_model');
$data['profile_data'] = $this->profile_model->get_records();
$this->load->view('pro_view', $data);
型号:
function get_records()
{
$r = $this->uri->segment(3);
$query = $this->db->get_where('profile', array('id' => $r));
return $query->result();
}
查看:
<input type="text" name="name" value="<?php echo $profile_data["name"] ?>" />
如果我var_dump(($profile_data);
我得到阵列中的所有内容。
我读了其他类似的问题和他们的答案,没有运气。
默认情况下,CI返回为对象,并且您需要为每个要打印的值$ profile_data [0] - >名称 –
这样回显,这正是我所需要的。 – Dray