gmarche/public/ajax/deleteProduits.php

18 lines
404 B
PHP

<?php
include '..\..\config\conf.php';
if($_POST['id'] !== null)
{
// Connexion à la base de données
$bdd = new \PDO("mysql:host=$host;dbname=$database_name", $username, $password);
$params['product_id'] = $_POST['id'];
// Suppression du bien/service
$requete = "DELETE FROM products WHERE id = :product_id";
$stmt = $bdd->prepare($requete);
$stmt->execute($params);
}