开发者

PHP null question?

开发者 https://www.devze.com 2023-03-30 05:34 出处:网络
I have this php statement in my login script... else if ($_POST[\'email\'] === $details[\'email\'] &&

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

0

精彩评论

暂无评论...
验证码 换一张
取 消