salut j'ai un formulaire d'ajout actualité et un tableaux qui extrais tous mes données ainsi pour chaque colonne de ce tableau j'ai un lien suppression qui effectue la suppression selon l'id qui est auto-increment
voici un exemple ou partie de mon code
le lien supprimer qui execute une action suppression
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 <table> <thead> <tr> <th>ID</th> <th>Titre</th> <th >Photo</th> <th >Mini actualité </th> </tr> </thead> <tbody> <?php include 'connexion.php'; $sql="SELECT * from actualite"; $req=mysql_query($sql) or die("erreur en sql". mysql_error()); $sql1="SELECT id FROM `actualite` ORDER BY `id` ASC "; $req1=mysql_query($sql1) or die("erreur en sql". mysql_error()); $m=mysql_fetch_array($req1); $f=$m['id']; $j=$f; print($f); while($l=mysql_fetch_array($req)){ ?> <tr><td > <td > <a href="acce-admin.php?choix=suppression&id=<?php print($j); ?>" >supprimer</a></td> <td ><?php print($l['id']); ?></td> <td ><?php print($l['titre']); ?></td> <td><?php print($l['image']); ?></td> <td><?php print($l['mini']); ?></td> </td> </tr> <?php $j++; } ?> </tbody> </table>
si je rentre les données on ordre croissant et j'essai supprimer la derniere ligne dans ma table sa marche parfaitement
Code : Sélectionner tout - Visualiser dans une fenêtre à part <a href="acce-admin.php?choix=suppression&id=<?php print($j); ?>" >supprimer</a>
mais si je supprime une ligne au milieu la suppression ne marcherai pas svp pouvez vous m'aidez sur ca
Partager