<?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_matiere_premiere.*, matiere_premiere.nom, matiere_premiere.qte_stock, unite.intituler, tbl_user.username FROM matiere_premiere, unite, stock_matiere_premiere, tbl_user WHERE stock_matiere_premiere.matiere_premiere=matiere_premiere.id AND matiere_premiere.unite=unite.id AND tbl_user.id=stock_matiere_premiere.user ORDER BY stock_matiere_premiere.id DESC');
        $pub->execute(array());
        $image = $pub->fetchAll();    
        echo(json_encode(['data' => $image]));