<?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);
        //$type_v = $inputdata['type_v'];
        $pub=$db->prepare('SELECT stock_repas.*, repas.nom, prix_repas.designation, prix_repas.qte_stock, tbl_user.username FROM prix_repas, repas, stock_repas, tbl_user WHERE stock_repas.prix_repas=prix_repas.id AND prix_repas.repas=repas.id AND tbl_user.id=stock_repas.user AND stock_repas.valid=? ORDER BY stock_repas.id DESC');
        $pub->execute(array(1));
        $image = $pub->fetchAll();    
        echo(json_encode(['data' => $image]));