<?php	

require_once '../includes/DbConnects.php';



$db = new DbConnect();
$con = $db -> connect();

//creating a query
 $stmt = $con->prepare("SELECT id, meal1, meal2, day FROM sunday_menu_tb;");
 
 //executing the query 
 $stmt->execute();
 
 //binding results to the query 
 $stmt->bind_result($id, $meal1, $meal2, $day);
 
 $sunday_menu = array(); 
 
 //traversing through all the result 
 while($stmt->fetch()){
 $temp = array();
 $temp['id'] = $id; 
 $temp['meal1'] = $meal1; 
 $temp['meal2'] = $meal2; 
 $temp['day'] = $day;  
 array_push($sunday_menu, $temp);
 }
 
 //displaying the result in json format 
 echo json_encode($sunday_menu);



