首页 > 解决方案 > Codeigniter 选择在哪里 AND

问题描述

如何选择 where 和 with code igniter ? //select * from item_user where email="myemail@gmail.com" and passwd="123"

function index_get() {
    $email = $this->get('email');
    $passwd = $this->get('passwd');

    $sql = "SELECT * FROM web_user ";

    if ($email != '') {
        $this->db->where('email', $email & 'passwd', $passwd);
        $item_user = $this->db->get('web_user')->result();

    }

    if ($item_user) {
        $this->response([
            'status' => true,
            'message' => 'found',
            'data' => $item_user
        ], REST_Controller::HTTP_OK);
    } else {
        $this->response([
            'status' => false,
            'message' => 'not found',
        ], REST_Controller::HTTP_NOT_FOUND);
    }
}

我认为我的语法错误,$this->db->where('email', $email & 'passwd', $passwd); 请帮助我,在哪里可以轻松学习这种 CI 内容?

标签: phpandroidcodeigniterflutter

解决方案


希望这可以帮助

 $this->db->where('email', $email);
 $this->db->where('passwd', $passwd);
 $item_user = $this->db->get('web_user')->result();

如果您正在使用GET方法使用此方法获取数据

$email =  $this->input->get('email');

如果您使用POST方法使用此方法获取数据

$email = $this->input->post('email');

推荐阅读