Well i have a problem. I should check if an email is in my database. I'm using CI (CodeIgniter)
MODEL:
function getUsersPoints($email)
{
$query = $this->db->query("SELECT * FROM `points` WHERE `p_email` = '$email'");
return $query->result();
}
CONTROLLER:
it comes a function that inserts all the data in table customers
, and then i should check if the email is in the second table points
, and if not, i should add it. so, what i have done:
$this->model->insert_customer($firstname, $lastname, $email, $telephone, $street, $house);
$getUserPoints = $this->model->getUsersPoints($email);
if(count($getUserPoints) == 0)
echo "ADD in table points";
else
echo "DO SOMETHING ELSE";
Can someone tell me what i'm doing wrong?