I'm currently trying to make a navigation menu from one of my columns in my mysql table.
Okay, so in my PHP class Database file, I have this function:
public function get_food_type(){
return $this->query("SELECT food_type FROM menu");
}
And in the other file I have the following code:
<?php
require_once('Includes/wzDB.php');
$content = "<div id=\"menu\">"
. "< nav id=\"food\" >"
. "< ul >"
. $type=wzDB::getInstance()->get_food_type();
print($type);
if($type->num_rows>0){
while($row = $type->fetch_assoc()){
echo "< li >" . htmlspecialchars($row['food_type']) . "< /li >";
}
}
"< /ul >"
. "< /nav >"
. "< /div>";
But when I try to run the file, I get the following error message
Catchable fatal error: Object of class mysqli_result could not be converted to string in C:\xampp\new_directory\htdocs\Wu_Zen2\menu.php on line 8
How do I fix this error?