this is the error i got trying to host a website for the first time.
Fatal error: Uncaught Error: Call to a member function execute() on bool in /storage/ssd3/611/13067611/public_html/app/database/db.php:47 Stack trace: #0 /storage/ssd3/611/13067611/public_html/app/controllers/topics.php(15): selectAll() #1 /storage/ssd3/611/13067611/public_html/index.php(3): include('/storage/ssd3/6...') #2 {main} thrown in /storage/ssd3/611/13067611/public_html/app/database/db.php on line 47
Also in the db.php file, i have a selectAll function. This is the code below please.
//Select all function
function selectAll($table, $conditions = [])
{
global $conn;
$sql = "SELECT * FROM $table";
if (empty($conditions)){
$stmt= $conn->prepare($sql);
$stmt->execute();
$records = $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
return $records;
}
else{
$i = 0;
foreach ($conditions as $key => $value){
if ($i === 0) {
$sql = $sql . " WHERE $key=?";
} else {
$sql = $sql . " AND $key=?";
}
$i++;
}
$stmt= executeQuery($sql, $conditions);
$records = $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
return $records;
}
}
please any help on how to deal with this error will be much appreciated. Also i was hosting on 000Webhost.com if that is also neccessary. Thank you all