Verification: a143cc29221c9be0

Php call to a member function fetch assoc

Topic

Call To A Member Function Fetch_assoc() On A Non-object

View Content

Random Error that im getting on my webhost, not localhost.

Fatal error: Call to a member function fetch_assoc() on a non-object in /home/*****/index.php on line 127

Line 127:
while ($premium = $row->fetch_assoc()) {

Code:




$row = $home->getList(1);
while ($premium = $row->fetch_assoc()) {
?>








href="server.html">


 
 





if($home->getStatus($premium['host'], $premium['port']) == true) {
echo "Online";
} else {
echo "Offline";
}
?>

The getList() function :

function getList($premium) {
$query = $this->con->query("SELECT * FROM `".$this->prefix."servers` WHERE `premium` = '".$premium."' && `ban` = '0'
ORDER BY (SELECT COUNT(*) FROM `".$this->prefix."votes` WHERE `serverId` = '".$this->prefix."servers.id') DESC") or die(mysqli_error());
return $query;
}