gmarche/public/ajax/updateProduitsDetails.php

20 lines
535 B
PHP

<?php
include '../../config/config.php';
$bdd = new \PDO("mysql:host=$db_server;dbname=$db_name", $db_username, $db_password);
if(isset($_POST))
{
$params["id"] = $_POST['id'];
$name = $_POST['produit'];
$quantite = $_POST['quantite'];
$prix = $_POST['prix'];
$image = $_POST['image'];
// Update Products details
$requete = "UPDATE products SET name = '$name', quantite = '$quantite', prix = $prix, image = '$image' WHERE id = :id";
$query = $bdd->prepare($requete);
$query->execute($params);
}