我不断从这个查询中得到奇怪的结果。
并不是说我没有使用 PDA,因为这只是一个原型(prototype)。在生产中,我计划拧紧所有螺钉并使其更加牢固。
include ('../includes/DBConnect.php'); //exactly how it is in other working files
$query = "SELECT * FROM CHARACTERS WHERE USER_ID=(SELECT ID FROM USERS WHERE EMAIL='"+$_SESSION['user']+"') ORDER BY id DESC"; //I have copy pasted this into mysql and it worked, switching the session variable with a string
我收到此行错误
while($row = mysqli_fetch_array($character_list)){
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\Node2\public\main.php on line 36
我知道这一定很愚蠢。我想不通。我只是查看了我编写的有效文档和其他文件。还有一些堆栈溢出线程无济于事。
非常感谢。
最佳答案
您使用 +
而不是 .
来连接字符串。一定要记住这是 PHP,而不是 JavaScript ;)
$query = "SELECT * FROM CHARACTERS WHERE USER_ID=(SELECT ID FROM USERS WHERE EMAIL='".$_SESSION['user']."') ORDER BY id DESC";
关于php - 得到奇怪的结果 : mysqli_fetch_array() expects parameter 1 to be mysqli_result,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18906322/