Salut,
J'ai ecrit un moceau de code afin de recuperer les donnees d'une base de donne Mysql et l'afficher dans un tableau. jusqu'a la pas de problemes.
Ensuite sur chaque ligne je souhaite y ajouter un boutons "SUPPRIMER" et un autre "EDITER" mais je ne sais pas commenent ecrire mon IF affecter au bouton supprimer et editer.

Voici mon code:

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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
require ('login.php');

// on cr?e la requ?te SQL 
$sql = 'SELECT ID,Full_Name,Email,Phone,Mobile_Phone,City FROM contact'; 

// on envoie la requ?te 
$req = mysql_query($sql) or die('SQL Error !<br>'.$sql.'<br>'.mysql_error()); 

?>

<style type="text/css">
<!--
.Style1 {color: #FFFFFF}
-->
</style>
<table width="646" border="1" align="center">
  <tr>
    <th width="94" bgcolor="#003399" scope="col"><span class="Style1">ID</span></th>
    <th width="110" bgcolor="#003399" scope="col"><span class="Style1">Full Name </span></th>
    <th width="96" bgcolor="#003399" scope="col"><span class="Style1">Email</span></th>
    <th width="102" bgcolor="#003399" scope="col"><span class="Style1">Phone</span></th>
    <th width="113" bgcolor="#003399" scope="col"><span class="Style1">Mobile Phone </span></th>
    <th width="91" bgcolor="#003399" scope="col"><span class="Style1">City</span></th>
    <th width="91" bgcolor="#003399" scope="col"><span class="Style1">Action</span></th>
  </tr>
  <tr>
<?php
// on fait une boucle qui va faire un tour pour chaque enregistrement 
while($data = mysql_fetch_assoc($req)) 
    { 
    // on affiche les informations de l'enregistrement en cours 
   echo "<tr>
	<td>".$data['ID']."</td>
	<td>".$data['Full_Name']."</td>
	<td>".$data['Email']."</td>
	<td>".$data['Phone']."</td>
	<td>".$data['Mobile_Phone']."</td>
	<td>".$data['City']."</td>
	<td><input type=\"submit\" name=\"".$data['ID']."\"  value=\"Delete\"></td>
	</tr>";
    } 
// Ici je bug je ne sais plus trop quoi ecrire !!!

if(isset($_POST['Delete'])) 
{
echo ('ligne a suprimer'$data['ID']);
$sql = mysql_query('DELETE * FROM contact WHERE ID = '.$data['ID'].''); 
$res = mysql_query($sql);
if(!$res) die ("Impossible de supprimer");
}

?>   
  </tr>
</table>

<?php
// on ferme la connexion ? mysql 
mysql_close(); 
?>
Si vous avez une petit idee merci.
Jerome