I used this code for another table it works fine and then when I used it for another table of the same database it shows me this error
PHP Fatal error: Uncaught Error: Call to a member function execute() on boolean in
I found some solution I tried but that solution cannot help me
$heroes = array();
$sql = "SELECT id,class_name,image,url FROM time_table;";
mysqli_set_charset($conn,'utf8');
$stmt = $conn->prepare($sql);
$stmt->execute();
$stmt->bind_result($id,$class_name,$image,$url);
while($stmt->fetch()){
$temp = [
'id'=>$id,
'class_name'=>$class_name,
'image'=>$image,
'url'=>$url
];
array_push($heroes, $temp);
}
echo json_encode($heroes);