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

[HELP] where问题

[复制链接]
发表于 2010-4-22 16:58:59 | 显示全部楼层 |阅读模式
$where = "name='{$name}' AND pwd='$pwd'";
$this->db->select("*")->from("mytable")->where($where)->limit(1);
where($where)不带参数where($where,NULL,FALSE)的话
会是这个样子
SELECT *
FROM (`mytable`)
WHERE `account='123'` AND password='111'
LIMIT 1
不知道有没有什么解决方案?
发表于 2010-4-22 17:47:26 | 显示全部楼层
$this->db->where('name', $name);
$this->db->where('pwd', $pwd);
$this->db->select("*")->from("mytable")->limit(1);
发表于 2010-4-22 17:51:11 | 显示全部楼层
$where = array('name' => $name, 'pwd' => $pwd);
$this->db->select("*")->from("mytable")->where($where)->limit(1);
发表于 2010-4-22 17:53:01 | 显示全部楼层
$where = "name='{$name}' AND pwd='$pwd'";
$this->db->select("*")->from("mytable")->where($where, NULL, FALSE)->limit(1);

本版积分规则