dongliuxia9495 2013-10-14 19:56
浏览 57

Mysql Count,If,Else

    {
    $SQL = $odb -> prepare("SELECT `membership` FROM `users` WHERE `ID` = :id");
    $count = $odb->num_rows;
    $SQL -> execute(array(':id' => $_SESSION['ID']));
    if ($count > 0){
        return true;
        } else {
        return false;
    }
}

What am I doing wrong?

The data must be retrieved from the database of User. And if the value of membership is 0, then get Return False deployed. If not, return True. But the script does not work ... What am I doing wrong?

  • 写回答

1条回答 默认 最新

  • duanpi2033 2013-10-14 19:58
    关注

    Put $count = $odb->num_rows; below $SQL -> execute(array(':id' => $_SESSION['ID']));

    评论

报告相同问题?