gmarche/public/ajax/updateProduitsDetails.php

22 lines
516 B
PHP

<?php
include '..\..\config\conf.php';
$bdd = new \PDO("mysql:host=$host;dbname=$database_name", $username, $password);
// check request
if(isset($_POST))
{
// get values
$params["id"] = $_POST['id'];
$name = $_POST['produit'];
$quantite = $_POST['quantite'];
$prix = $_POST['prix'];
// Update Products details
$requete = "UPDATE products SET name = '$name', quantite = '$quantite', prix = $prix WHERE id = :id";
$query = $bdd->prepare($requete);
$query->execute($params);
}