how to check if username already exists in codeigniter

后端 未结 8 1334
无人共我
无人共我 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 00:52

    You have an error in the mysql query:-

    SELECT * WHERE ` = 'muraddnw@gmail.com' LIMIT 1
    

    Your code has not specified which table to query from. So use following:-

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

    Hope this helps.

提交回复
热议问题