1
I want to check if an email already exists in the database. I am doing the following.
$this->load->database();
$query = $this->db->get_where('usuario', array('email'));
$result = $query->result_array();
if(count($result) > 0) {
echo "email existe";
} else { echo "email não existe";}
Only that always returns me that the email already exists even if I type a different one. Where is my mistake? Or I am doing wrong and there is another way?
Use the Codeigniter validation system. Use validation
is_unique
.– Wallace Maxters