不管我做什么,总是1小于0

时间:2019-07-09 15:55:44

标签: php

以下代码返回1,当我将其与0进行比较时,它返回false。这没有任何意义...

function CheckMAG($newmac, $con) {
    LogToFile("Renew","CheckMAC",$newmac);
    $encMAC = base64_encode(strtoupper($newmac));
    LogToFile("DebugFile","CheckMAG Encripted",$encMAC);
    $resultmag_devices = mysqli_query($con, "SELECT `id` FROM `mac_devices` WHERE `mac`='{$encMAC}");
    LogToFile("Renew","CheckMAC Results",print_r($resultmac_devices));
    $sqlResults = intval(mysqli_num_rows($resultmac_devices));
    if ($sqlResults > 0) {
        LogToFile("DebugFile","SQLResults is","BIGGER");
        $return = TRUE;
    }else{
        LogToFile("DebugFile","SQLResults is","SMALLER");
        $return = FALSE;
    }
    return $return;
}

当我手动运行查询时,它返回1行。 日志显示:

1562685478 Executing CheckMAC: Values are: '00:1A:79:3B:01:AD'
1562685478 Executing CheckMAC Encripted: Values are: 'MDA6MUE6Nzk6M0I6MDE6QUQ='
1562685478 Executing CheckMAC Results: Values are: '1'
1562685478 Executing SQLResults is: Values are: 'SMALLER'
1562686000 Executing Renew DanutStoica-x2 : Values are: 'streamline'
1562686000 Executing Checking custom fields for DanutStoica-x2 : Values are: '1'

我不知道可以尝试什么...请在这里可以帮忙吗?

我尝试了intval,但没有,结果也一样。 没有错误消息显示。 通过比较2个整数,我期望1大于0。

0 个答案:

没有答案