<?php
session_start();
    header('Access-Control-Allow-Origin:*');
    header('Content-Type; application/json; charset=utf-8');
    header('Access-control-Allow-Method: POST');
    header('Access-control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-request-With');
    include('db.php');
        $inputdata = json_decode(file_get_contents("php://input"), true);
        
        $prix_repas = $inputdata['prix_repas'];
        
        $pub=$db->prepare('SELECT fiche_repas.*, matiere_premiere.nom AS nom_matiere, unite.intituler AS intituler FROM fiche_repas, matiere_premiere, unite WHERE fiche_repas.matiere_premiere=matiere_premiere.id AND matiere_premiere.unite=unite.id AND fiche_repas.prix_repas=?');
        $pub->execute(array($prix_repas));
        $image = $pub->fetchAll();
        echo(json_encode(['data' => $image]));