Bonjour,

J ai un souci mon update ne fonctionne pas et je ne comprend pas pourquoi

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
$sql = "SELECT dvd, zone, format FROM general order by dvd";
$req = mysql_query($sql) or die( mysql_error() ) ;
$total = mysql_num_rows($req);
{
echo '<form method="post" action="test.php">';
echo '<table>'."\n";
echo '<tr>';
echo '<th ><b><u>DVD.</u></b></th>';
echo '<th ><b><u>ZONE</u></b></th>';
echo '<th><b><u>FORMAT</u></b></th>';
echo '</tr>'."\n";
while($row = mysql_fetch_array($req))
{
echo '<tr>';
echo '<td>'.$row["DVD"].'</td>';
echo '<td><input type="text" name="ZONE" value="'.$row["ZONE"].'"/></td>';
echo '<td><input type="text" name="format" value="'.$row["format"].'"/></td>';
echo '</tr>'."\n";
}
echo '</table>'."\n";
echo '<input type="hidden" name="dvd2" value='.$_POST['dvd'].' /><br><center><input type="submit" name="ok" value="Modifier"/></center>';
echo '</form>';
}
if (isset($_POST['ok']))
 
{
 
$sql2= "UPDATE general SET zone='".$_POST['zone']."', format='".$_POST['format']."'
WHERE dvd='".$_POST['dvd2']."'";
$req2= mysql_query($sql2) or die('Erreur SQL !'.$sql2.'<br>'.mysql_error());
 
if(isset($req2))
{
echo "Modification OK" ;
}
}
?>
Merci de votre aide