drodsh7940 2014-04-01 13:00
浏览 63
已采纳

Prepared语句返回空结果,可能是语法错误

When I execute the prepared statement the results are returned empty. If I copy and paste the statement into phpMyAdmin it executes properly. $_SESSION['userGroup'] has been checked and confirmed to contain the proper value but $systems remains undefined.

Am I missing something?

        $stmt = $mysqli -> prepare("SELECT `Systems` FROM `groups` WHERE `GroupID` = ?");
            echo $mysqli -> error;

        $stmt -> bind_param('i', $_SESSION['userGroup']);
        $stmt -> execute();
        $stmt -> store_result();
        $stmt -> bind_result($systems);
  • 写回答

2条回答 默认 最新

  • drmq16019 2014-04-01 13:08
    关注

    Just try

    $stmt -> bind_param('i', $_SESSION['userGroup']);
    $stmt -> execute();
    $stmt -> bind_result($systems);
    $stmt -> fetch();
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?