wuwu1222 发表于 2010-4-22 16:58:59

where问题

$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
不知道有没有什么解决方案?

zycbob 发表于 2010-4-22 17:47:26

$this->db->where('name', $name);
$this->db->where('pwd', $pwd);
$this->db->select("*")->from("mytable")->limit(1);

zycbob 发表于 2010-4-22 17:51:11

$where = array('name' => $name, 'pwd' => $pwd);
$this->db->select("*")->from("mytable")->where($where)->limit(1);

zycbob 发表于 2010-4-22 17:53:01

$where = "name='{$name}' AND pwd='$pwd'";
$this->db->select("*")->from("mytable")->where($where, NULL, FALSE)->limit(1);
页: [1]
查看完整版本: where问题