I can't get an IF-statement to do the "right" thing, the code;
public function getUID($email)
{
$query = $this->dbh->prepare("SELECT id FROM users WHERE email = ?");
$query->execute(array($email));
$row = $query->fetch(\PDO::FETCH_ASSOC);
alert($row, true); // array(1) { ["id"]=> string(1) "0" }
alert(is_array($row), true); // bool(true)
alert($row == false, true); // bool(false)
if( $row == false ) {
// Here we are!
return false;
}
return $row['id'];
}
For some reason the if-statement thinks the result is true, and I can't understand why :[] The output from the sql-command seems correct, we should get an id-entry that is 0...
When writing this question I thought about dropping this question and comparing $row to NULL instead. but that isn't helping. It still goes to return false...
Aucun commentaire:
Enregistrer un commentaire