how to check if username already exists in codeigniter

后端 未结 8 1347
无人共我
无人共我 2020-12-20 00:33

I am working on a site in codeigniter.I am not so expert using framework.Here I have to check if email already exists in database.I have coded the required functionality but

8条回答
  •  眼角桃花
    2020-12-20 01:14

    Your Model is like

    $this->db->select('id');
    $this->db->where('email', $email);
    

    please tell the mysql from which table you want to get the record.

    $this->db->from('tablename');

    it would be like

    $this->db->select('id');
    $this->db->from('tablename');
    $this->db->where('email', $email);
    

提交回复
热议问题