为什么此查询返回布尔值?

时间:2016-04-02 16:07:34

标签: php mysql arrays

我正在测试这组代码,我收到错误:

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\Program Files (x86)\Ampps\www\Connection Files\friends-list.php on line 16

我不确定是什么导致这组代码返回一个布尔值:

$cuser = $_COOKIE["cuser"];
$csalt = $_COOKIE["csalt"];

$queryuserstats = mysqli_query($connection, "SELECT * FROM s_users WHERE Salt='csalt'");
$userstats = mysqli_fetch_array($queryuserstats, MYSQLI_ASSOC);
$userfriendstable = ("$userstats[0]['Username']" . "Friends");

$findfriends = mysqli_query($connection, "SELECT * FROM $userfriendstable");
$userfriends = mysqli_fetch_array($findfriends, MYSQLI_ASSOC);

我怀疑我将变量userfriendstable设置错误,但我并不完全确定。

0 个答案:

没有答案