PHP null question?
I have this php statement in my login script...
else if ($_POST['email'] === $details['email'] &&
$_POST['password'] === $details['password'] &&
is_null($details['logcount'])) {
echo 'Account not active!';
}
In my mysql table the logcount by default is NULL, when a user activates their account the logcount turns to 0 then increments eve开发者_运维问答ry time they login.
On my login script I am having trouble with PHP testing it to see if it is NULL or not. I have pulled all the users data via an associative array using PDO.
Thanks in advance.
Try using the isset() function. If not, then you may have to tell PDO how to handle nulls for your db server. Look at the accepted solution here:
PHP PDO fetch null
and setattribute docs here:
http://php.net/manual/en/pdo.setattribute.php
精彩评论