salut je cherche de faire un script pour modifier mes données ,mais lorsque j’exécute mon script rien ne changer dans ma base ,je besoin de vous aide et merci d'avance ,le script est le suivant:
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
mysql_connect("localhost","root","");
mysql_select_db("ma base");?>
<table>
 
<tr>
<form action="mod.php" method="post">
<td><div align="center" class="Style2">
<h4>Site</h4>
</div></td>
<td><p>
<label>
<select name="id">
<option> </option>
<?php
$req="select DISTINCT id from user ";
$ql=mysql_query($req) or die ("erreur requete");
while($rrr=mysql_fetch_array($ql)){
echo"<option>".$rrr["id"]."</option>";
}
?>
</select>
</label>
</p></td>
<td><input type="submit" name="ok" value="ok" /></td></form>
</tr>
<tr>
 
<?php
 
if(isset($_POST['ok']) && !empty($_POST['id']) )
{ 
extract($_POST);
 
 
 
 
$query="SELECT *
FROM user
WHERE user.id='".$_POST['id']."'";
$mes_resultats=mysql_query($query);
if(mysql_num_rows($mes_resultats)==0){
echo"<script type=\"text/javascript\">alert('Pas de données!');history.back();</script>";
exit();
}
else if (mysql_num_rows($mes_resultats)!=0)
{while($row=mysql_fetch_array($mes_resultats))
{
echo " <table border=\"1\" cellpadding=\"1\" cellspacing=\"1\" align=\"center\">";
echo "<tr>";echo " <td bgcolor=\"#FFFFFF\" class=\"Style3\">id</td>"; echo "<td>" ; echo "<input type=\"text\" name=\"id\" value=\"".$row["id"]."\"/>";echo "</td>";
echo "</tr>";
echo "<tr>";echo " <td bgcolor=\"#FFFFFF\" class=\"Style3\">date </td>"; echo "<td>" ; echo "<input type=\"text\" name=\"date\" value=\"".$row["date_ins"]."\"/>";echo "</td>";
echo "</tr>";
echo "<tr>";echo " <td bgcolor=\"#FFFFFF\" class=\"Style3\">pseudo</td>"; echo "<td>" ; echo "<input type=\"text\" name=\"pseudo\" value=\"".$row["pseudo"]."\"/>";echo "</td>";
echo "</tr>";
echo "</table>";}}
 
echo"<div align=\"center\"> ";
echo "<form action=\"mod.php\" method=\"post\">";
echo "<table width=\"215\">";
echo " <tr>";
echo " <td width=\"61\"><label>";
echo " <input type=\"submit\" name=\"mod\" value=\"modifier\" />";
echo " </label></td>";
 
echo "</tr>";
echo "</table>";
echo "</form>";
echo "</div>";
}
 
 
 
?>
<?
if(isset($_POST['mod'])){
$sql="UPDATE `user` SET `id` = '".$_POST['id']."',
`pseudo` = '".$_POST['pseudo']."',
`date_ins` = '".$_POST['date']."' WHERE `user`.`id` ='".$_POST['id']."' ";
mysql_query($sql) or die ("erreur mise à jour");
}
?>
 
 
 
 
 
 
</tr>
 
</table>