1

在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`

请帮我解决。提前感谢您的帮助

4

1 回答 1

0

如果有帮助,试试这个:

$this->db->where($where, null, false);

尝试这个:

$where  = " `studentid` = '".$this->input->post('username')."' AND
            `password`  = password('".$this->input->post('password')."') AND
            `status`    = 1";
于 2013-11-07T07:14:11.330 回答