!http://image.noelshack.com/fichiers/2019/27/4/1562273901-image.png
I'm currently trying to do an articles generator with PHP and it kinda works BUT I can't delete ("SUPPRIMER" links) my articles and I dont know why, can you check my code
I already tried the code before in another folder and it works fine but here no, why ? Not file location problem since i'm doing everything in the same file (index.php)
Maybe my block is not in the good place of the code ? idk
<?php $articles = $bdd->query('SELECT * FROM articles ORDER BY date_time_publication DESC'); ?>
<ul>
<?php
while($a = $articles->fetch())
{
echo '<li><a href="articles.php?id=' . $a['id']. '">' . $a['titre'] . '</a> | <a href="index.php?edit=' . $a['id'] . '">Modifier </a> | <a href= "index.php?suppression=true&id=' . $a['id'] . '">Supprimer</a></li>';
}
if(isset($_GET['suppression']) && $_GET['suppression'] == true)
{
$suppr_id = htmlspecialchars($_GET['id']);
$suppr = $bdd->prepare('DELETE FROM articles WHERE id = :id');
$suppr->bindParam(':id', $suppr_id);
$suppr->execute();
header('location:index.php');
exit();
}
?>
</ul>
It's just a block from a whole page of code, if you want the complete code here it is https://sharemycode.fr/test