-1
这是我的代码。我试图让accountId的价值返回并分配给$ accountId但我总是得到0返回。查询很好,它返回我想要在PHP中的值我的管理员,但它不会在这里返回它。你知道为什么吗?Bind_Result始终返回0
$mysqli = new mysqli($SQLhost, $SQLusername, $SQLpassword, $SQLdatabase);
$stmt = $mysqli->prepare("SELECT accountId FROM Account WHERE accountUsername=? AND accountPassword=?");
$stmt->bind_param('ss', $username,$password);
$stmt->execute();
$stmt->bind_result($accountId);
$_SESSION['accountId'] = $accountId;
你能提供一些调试值吗?回声出行的数量和var_dump $ accountId – Ali 2014-10-19 20:22:15
我加$ stmt-> fetch();它在最后工作 – 2014-10-19 20:31:43