[英]if statement in PHP
The word "true"
is in the database where its getting the data from, but the if statement is going to the else. 单词
"true"
在数据库中,从那里获取数据,但是if语句转到else。
while(odbc_fetch_row($user)){
echo "<div style='position:absolute;overflow:scroll;height:370px;'>";
$name = odbc_result($user, 'username');
$email = odbc_result($user, 'email');
$admin = odbc_result($user, 'admin');
$lastLogin = odbc_result($user, 'lastLogin');
$userDisabled = odbc_result($user, 'disabled');
$fullname = odbc_result($user, 'firstName') . " " . odbc_result($user, 'lastName');
echo "<br><h2> " . $name . "</h2>";
echo $fullname . "<br>";
echo " " . $email;
echo "<br>Last Login Time: <br>" . $lastLogin;
echo "<br>";
if($userDisabled == "true"){
echo "<input type='checkbox' class='disableUser' checked id='disableUser'>Disable User<br>";
}else{
echo "<input type='checkbox' class='disableUser' id='disableUser' >Disable User<br>";
}
echo "<br>";
}
so try with this : 所以试试这个:
if((is_bool($userDisabled) && $userDisabled === TRUE) || (is_string($userDisabled) && strtoupper($userDisabled) == "TRUE" ) {
# do your job
}else {
# you can eat or sleep :)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.