23 lines
690 B
PHP
23 lines
690 B
PHP
<?php
|
|
include '../../config/conf.php';
|
|
|
|
if($_POST['id_r'] !== null)
|
|
{
|
|
// Connexion à la base de données
|
|
$bdd = new \PDO("mysql:host=$host;dbname=$database_name", $username, $password);
|
|
|
|
$params['souhait_id'] = $_POST['id_r'];
|
|
$filename = $_POST['nom_image'];
|
|
$nom_antenne = $_POST['antenne_slug'];
|
|
// Suppression du bien/service
|
|
$requete = "DELETE FROM souhaits WHERE id = :souhait_id";
|
|
$stmt = $bdd->prepare($requete);
|
|
$stmt->execute($params);
|
|
// Suppression de la photo du produit si elle existe
|
|
$nom_fichier = '../uploads/recherches/'.$nom_antenne.'/'.$filename;
|
|
if (file_exists($nom_fichier)) {
|
|
unlink($nom_fichier);
|
|
}
|
|
}
|
|
?>
|