L.e.e. 发表于 2013-5-30 09:34:14

$this->db->get_where() 查询结果 问题

$this->db->get_where() 查询 成功 和 失败 怎么取返回值?

Hex 发表于 2013-5-30 10:25:16

看看是否返回 true or false

L.e.e. 发表于 2013-5-30 10:29:16

Hex 发表于 2013-5-30 10:25 static/image/common/back.gif
看看是否返回 true or false

他返回 TURE 和 FALSE吗?

$chk = $this->db->get_where() ?'ok' : 'no';那这么写 可以了?

Hex 发表于 2013-5-30 13:11:06

L.e.e. 发表于 2013-5-30 10:29 static/image/common/back.gif
他返回 TURE 和 FALSE吗?

$chk = $this->db->get_where() ?'ok' : 'no';那这么写 可以了? ...

可能没有返回值 你要自己测试下,文档没有明确说明。
这里是 CI 不明确的地方。

L.e.e. 发表于 2013-5-30 13:43:58

Hex 发表于 2013-5-30 13:11 static/image/common/back.gif
可能没有返回值 你要自己测试下,文档没有明确说明。
这里是 CI 不明确的地方。 ...

呵呵 知道了~但还是 谢谢你哈

师襄 发表于 2013-6-19 11:43:32

$this->db->affected_rows() 用这个查询返回条数

但是delete语句不能用

Raphael 发表于 2013-6-19 11:57:21

$data['files'] = $this->db->get_where('files', array('owner =' => '$owner'))->result();
if(count($data['files']) > 0)
{
do.....
}

L.e.e. 发表于 2013-6-19 13:08:18

Raphael 发表于 2013-6-19 11:57 static/image/common/back.gif
$data['files'] = $this->db->get_where('files', array('owner =' => '$owner'))->result();
if(count($da ...

哦哦 学到了~哈 谢谢

晨风_NS8UZ 发表于 2015-6-6 18:32:42

也可以这样
                eg:
                $query = $this->db->get_where('user',array('mobile'=>$username),1,2);
                $row1 = $query->row();
               eg:
                $query = $this->db->get_where('user',array('mobile'=>$username),1,2);
                $row1 = $query->result->array();

晨风_NS8UZ 发表于 2015-6-6 18:34:03

晨风_NS8UZ 发表于 2015-6-6 18:32
也可以这样
                eg:
                $query = $this->db->get_where('user',array('mobile'=>$username),1,2 ...

$query = $this->db->get_where('user',array('mobile'=>$username),1,2 ...
$row = $query->row_array();
页: [1]
查看完整版本: $this->db->get_where() 查询结果 问题