用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2561|回复: 2
收起左侧

CRUD检索,怎么只能得到第一个字段的数据?

[复制链接]
发表于 2009-6-1 10:09:46 | 显示全部楼层 |阅读模式
$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的数据,其它字段数据都未返回。。
发表于 2009-6-1 11:20:28 | 显示全部楼层
select 写错了,再仔细看一下手册吧。
这样写:
$this->db->select('title, content, date');
 楼主| 发表于 2009-6-1 12:57:03 | 显示全部楼层
多谢,还真写错了。。

本版积分规则