Currently I'm trying to match types, in example Mains should be grouped together and appetizers should be grouped together, then display them in the right section. I could do this for one but I'm hoping there's another way of doing it
<?php
class Menu extends Database{
public function __construct($id, $appetisers) {
$this->app = $appetisers;
$this->id = $id;
$sql = "SELECT r.id,
m.price, i.name AS iname, i.description, i.vegan, i.itemType, i.serviceTime
FROM restaurant r
JOIN menu m ON m.restaurantId=r.id
JOIN item i ON i.menuId=m.id
WHERE r.id = :id AND i.itemType = :appetisers";
$stmt = $this->connect()->prepare($sql);
$stmt->bindValue(':id', $id);
$stmt->bindValue(':appetisers', $appetisers);
$stmt->execute();
$this->result = $stmt->fetchAll();
}
public function name(){
return $this->result['iname'];
}
}