CRUD检索,怎么只能得到第一个字段的数据?
$this->db->select('firstname','lastname','office','cell','img','email','bio');$this->db->where('id', $this->session->userdata('DX_user_id'));
$query = $this->db->get('users');
//there should be one row
return $query->row_array();
测试了下,谁放到select里面的第一个,就只能得到谁的数据,上面的代码返回的是firstname的数据,其它字段数据都未返回。。 select 写错了,再仔细看一下手册吧。
这样写:
$this->db->select('title, content, date'); 多谢,还真写错了。。
页:
[1]