-3

这是我的代码-

$link = @new mysqli(_HOST, _USER, _PASS, _DB);
$result = $link->query("SELECT * FROM CHAT_USERS;");
if ($result->num_rows <= 0){
    echo "None Found.";
}
else
{
    while ($row = $result->fetch_assoc())
    {
        $strUsers .= $row['USERNAME']. ",";
        $roomCount += 1;
    }
    $strUsers = $roomCount.",".$strUsers;
}

// Close connection
$mysqli_result->free();    //line 37
$link->close();

我得到的-

Notice: Undefined variable: mysqli_result in getUsers.php on line 37 Fatal error: Call to a member function free() on a non-object in getUsers.php on line 37

我究竟做错了什么?

4

1 回答 1

2

你从哪里得到 $mysqli_result ?您只能在实际对象上调用方法。

我认为,$mysqli_result->free();应该改为$result->free();

于 2013-05-28T12:40:28.327 回答