在codeIgniter中使用mysql密码函数的过程是什么。
我的控制器
$where = array(
"studentid" => $this->input->post('username'),
"password" => "password('".$this->input->post('password')."')",
"status" =>1
);
$user = $this->void->getData("users",$where);
我的模特函数
public function getData($table,$where,$order = 'id')
{
$this->db->order_by($order);
$this->db->where($where);
$query=$this->db->get($table);
return $query->result();
}
这不起作用。这是生成以下查询,因为您可以看到问题
SELECT * FROM (`users`) WHERE `studentid` = '054418' AND `password` = 'password(\'054418\')' AND `status` = 1 ORDER BY `id`
请帮我解决问题。提前感谢帮助
答案 0 :(得分:0)
如果有帮助的话,试试这个:
$this->db->where($where, null, false);
试试这个:
$where = " `studentid` = '".$this->input->post('username')."' AND
`password` = password('".$this->input->post('password')."') AND
`status` = 1";