I am getting this error I am new to PHP but I am hoping someone can help me
EXAMPLE OF CODE:
<?php
include('config.php');
session_start();
if (!isset($_SESSION['loggedin'])) {
header('Location: index.php');
exit;
}
$html_text = "";
$res = $dbforum->query("SELECT * FROM consumers;");
?>
<?php
while(($row = $res->fetch_assoc()) !== null){
$time_left_days = 'n/a';
$time_end_str ='';
$time_end_date = new DateTime();
$current_date = new DateTime();
$time_html = '';
$module_str = $row['PROJECT-0'];
if($module_str != "0"){
$module_exploded = explode("|", $module_str);
if($module_exploded[0] == "LIFETIME"){
$time_left_days = 'never';
} else {
$time_left_days = 'not started. ('.$module_exploded[0].' to be used.)';
}
if(sizeof($module_exploded) > 1) {
$start_time = $module_exploded[1];
$time_end_str = date('Y-m-d H:i', strtotime($start_time.'+ '.$module_exploded[0]));
$time_end_date = new DateTime($time_end_str);
$interval = $time_end_date->diff($current_date);
$time_left_days = $interval->format('%m month(s) %d day(s) %h hour(s)');
}
} else {
$time_left_days = 'n/a';
}
$time_html = $time_html.'Script (private)<br> expires: '.$time_left_days.'<br><ul class="button-group"><li><a href="handler.php?action=add_time&duration=1&module=script_private&product_key='.$row['product_key'].'" class="button">+1 day</a><a href="handler.php?action=add_time&duration=7&module=script_private&product_key='.$row['product_key'].'" class="button">+7 days</a><a href="handler.php?action=add_time&duration=31&module=script_private&product_key='.$row['product_key'].'" class="button">+31 days</a><a href="handler.php?action=set_lifetime&module=script_private&product_key='.$row['product_key'].'" class="button">lifetime</a><a href="handler.php?action=reset_time&module=script_private&product_key='.$row['product_key'].'" class="button">reset</a></ul>';
$module_str = $row['PROJECT-0'];
if($module_str != "0"){
$module_exploded = explode("|", $module_str);
if($module_exploded[0] == "LIFETIME"){
$time_left_days = 'never';
} else {
$time_left_days = 'not started. ('.$module_exploded[0].' to be used.)';
}
if(sizeof($module_exploded) > 1) {
$start_time = $module_exploded[1];
$time_end_str = date('Y-m-d H:i', strtotime($start_time.'+ '.$module_exploded[0]));
$time_end_date = new DateTime($time_end_str);
$interval = $time_end_date->diff($current_date);
$time_left_days = $interval->format('%m month(s) %d day(s) %h hour(s)');
}
} else {
$time_left_days = 'n/a';
}
$time_html = $time_html.'<br> Script (public)<br> expires: '.$time_left_days.'<br><ul class="button-group"><li><a href="handler.php?action=add_time&duration=1&module=script_public&product_key='.$row['product_key'].'" class="button">+1 day</a><a href="handler.php?action=add_time&duration=7&module=script_public&product_key='.$row['product_key'].'" class="button">+7 days</a><a href="handler.php?action=add_time&duration=31&module=script_public&product_key='.$row['product_key'].'" class="button">+31 days</a><a href="handler.php?action=set_lifetime&module=script_public&product_key='.$row['product_key'].'" class="button">lifetime</a><a href="handler.php?action=reset_time&module=script_public&product_key='.$row['product_key'].'" class="button">reset</a></ul>';
$ban_button = '';
if($row['is_banned'] == '1'){
$ban_button = '<a href="handler.php?action=unban&product_key='.$row['product_key'].'" class="button">unban</a>';
} else {
$ban_button = '<a href="handler.php?action=ban&product_key='.$row['product_key'].'" class="button">ban</a>';
}
$html_text = $html_text.'<div
class="user_information">'.$row['product_key'].' {hwid='.$row['hwid'].', ip='.$row['ip'].'} <ul class="button-group" style="float: right;"><li>'.$ban_button.'<a href="handler.php?action=reset_hwid&product_key='.$row['product_key'].'" class="button">reset hwid</a><a href="logs.php?product_key='.$row['product_key'].'" class="button">logs</a><a href="handler.php?action=remove&product_key='.$row['product_key'].'" class="button">remove</a></ul><hr>'.$time_html.' </div>';
}
?>
FULL ERROR:
Fatal error: Uncaught Error: Call to a member function fetch_assoc() on bool in /home/vol9_6/epizy.com/epiz_31774109/htdocs/home.php:16 Stack trace: #0 {main} thrown in /home/vol9_6/epizy.com/epiz_31774109/htdocs/home.php on line 16
I appreciate any help it is probably an easy fix but again im new to PHP so sorry if its dumb.