<?php
  require 'api.php';
  $date = "2023-02-06";
  //$date = date("Y-m-d");
  $request = "SELECT at.NoAtelier, at.Nom, at.Prenom, at.Telephone, at.NoChasis, at.Vehicule, at.Description, at.Reception, at.Temps FROM atelier1 AS at LEFT OUTER JOIN atelier_suite1 AS ats ON at.NoAtelier = ats.NoAtelier WHERE at.Date = :date1 OR ats.Date = :date2";
  //$request = "SELECT at.NoAtelier, at.Nom, at.Prenom, at.Telephone, at.NoChasis, at.Vehicule, at.Description, at.Reception, at.Temps FROM atelier1 AS at WHERE at.Date = '" . $date . "'";
  //echo $request;
  $statement = Connection::getStatement($request);
  $statement->bindParam(":date1", $date);
  $statement->bindParam(":date2", $date);
  $statement->execute();
  $emparray = $statement->fetchAll();
  //echo count($emparray);
  //print_r($emparray);
  $json = json_encode($emparray);
  //echo json_last_error_msg();
  echo $json;
?>