Bonjour,

voila j ai un fichier hp qui fait bien ce que je veux le problème c'est que j ai fait 3 if { echo ... }

y en a un qui s'exécute bien et deux qui s'affiche tout le temps et ne prennent pas en compte mes if

je ne comprend pas pourquoi

voici mon code

je mets en rouge les if qui fonctionne pas et en bleu celui qui fonctionne

Merciiii

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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?php

include ('cat-haa/config.php');
include ('cat-haa/connexion.php');

if (isset($_POST['ok']))

{
$sql2= "UPDATE contenu SET reference='".$_POST['reference']."', artiste='".$_POST['artiste']."',album='".$_POST
['album']."',format='".$_POST['format']."'
WHERE id='".$_POST['id']."'" ;


$req2= mysql_query($sql2) or die('Erreur SQL !'.$sql2.'<br>'.mysql_error());


}

if (isset($_POST['suppr']))


{
$sql3= "delete from contenu WHERE id='".$_POST['id']."'" ;


$req3= mysql_query($sql3) or die('Erreur SQL !'.$sql3.'<br>'.mysql_error());


}


?>


<head>
<link rel="stylesheet" type="text/css" href="../cat-haa/style-cat.css">
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="../cat-haa/style-cat-ie6.css">
<![endif]-->
</head>
<body link="#000000" vlink="#FFFFFF" alink="#FFFFFF">
<div id="body-cat">
<div id="menu-container-cat">

<div id="menu-container-cat1"><b>
<a href="cat-haa.php?lettre=[0-9]" class="active"><span class="text-cat">0-9</span></a> |
<a href="cat-haa.php?lettre=A" target="_self"><span class="text-cat">A</span></a> |
<a href="cat-haa.php?lettre=B" target="_self"><span class="text-cat">B</span></a> |
<a href="cat-haa.php?lettre=C" target="_self"><span class="text-cat">C</span></a> |
<a href="cat-haa.php?lettre=D" target="_self"><span class="text-cat">D</span></a> |
<a href="cat-haa.php?lettre=E" target="_self"><span class="text-cat">E</span></a> |
<a href="cat-haa.php?lettre=F" target="_self"><span class="text-cat">F</span></a> |
<a href="cat-haa.php?lettre=G" target="_self"><span class="text-cat">G</span></a> |
<a href="cat-haa.php?lettre=H" target="_self"><span class="text-cat">H</span></a> |
<a href="cat-haa.php?lettre=I" target="_self"><span class="text-cat">I</span></a> |
<a href="cat-haa.php?lettre=J" target="_self"><span class="text-cat">J</span></a> |
<a href="cat-haa.php?lettre=K" target="_self"><span class="text-cat">K</span></a> |
<a href="cat-haa.php?lettre=L" target="_self"><span class="text-cat">L</span></a> |
<a href="cat-haa.php?lettre=M" target="_self"><span class="text-cat">M</span></a> |
<a href="cat-haa.php?lettre=N" target="_self"><span class="text-cat">N</span></a> |
<a href="cat-haa.php?lettre=O" target="_self"><span class="text-cat">O</span></a> |
<a href="cat-haa.php?lettre=P" target="_self"><span class="text-cat">P</span></a> |
<a href="cat-haa.php?lettre=Q" target="_self"><span class="text-cat">Q</span></a> |
<a href="cat-haa.php?lettre=R" target="_self"><span class="text-cat">R</span></a> |
<a href="cat-haa.php?lettre=S" target="_self"><span class="text-cat">S</span></a> |
<a href="cat-haa.php?lettre=T" target="_self"><span class="text-cat">T</span></a> |
<a href="cat-haa.php?lettre=U" target="_self"><span class="text-cat">U</span></a> |
<a href="cat-haa.php?lettre=V" target="_self"><span class="text-cat">V</span></a> |
<a href="cat-haa.php?lettre=W" target="_self"><span class="text-cat">W</span></a> |
<a href="cat-haa.php?lettre=X" target="_self"><span class="text-cat">X</span></a> |
<a href="cat-haa.php?lettre=Y" target="_self"><span class="text-cat">Y</span></a> |
<a href="cat-haa.php?lettre=Z" target="_self"><span class="text-cat">Z</span></a></b>
</div>

<div id="menu-container-cat2">

<?php
$rq = "SELECT DISTINCT nom_label FROM label ORDER BY nom_label";
$result = mysql_query($rq)
or die ("Exécution de la requête impossible");


echo "<form action='cat-haa2.php' method='post'>
<select name='nom_label'>";
while ($liste=mysql_fetch_array($result))
{
extract($liste);
echo "<option value='$nom_label'>$nom_label\n";
}
echo " </select>\n";




echo "<input type='submit'"."value='Go'></form>\n";

?>

</div>
</div>

<?php




if(isset($req2))


{
echo ("L'insertion a été correctement effectuée") ;
echo '<br><a href="cat-haa_modif.php">Retour </a></br>';
}

if(isset($req3))


{
echo ("Suppression ok") ;
echo '<br><a href="cat-haa_modif.php">Retour</a></br>';
}


echo '<table>

<tr>
<th>id</th>
<th>Label</th>
<th>Référence</th>
<th>Artiste</th>
<th>Album</th>
<th>Format</th>
<th>Modifier</th>
<th>supprimer</th>


</tr>';

// paramètre reçu désignant le critère du nom du label recherché


$param1 = mysql_real_escape_string($_GET['lettre']);



//
$sql = "SELECT * FROM label
INNER JOIN contenu ON contenu.id_label = label.id_label
Where nom_label REGEXP '^$param1' order by nom_label, reference;
";
$req = mysql_query($sql);
while ($resultat = mysql_fetch_array($req))


{
echo '<tr>';

echo '<td>'.$resultat['id'].'</td>';
echo '<td>'.$resultat['nom_label'].'</td>';
echo '<td>'.$resultat['reference'].'</td>';
echo '<td>'.$resultat['artiste'].'</td>';
echo '<td>'.$resultat['album'].'</td>';
echo '<td>'.$resultat['format'].'</td>';
echo '<td><a href="modifier.php?id='.$resultat['id'].'"><font color="#ffffff"><u>Modifier</u></font></a></td>';
echo '<td><a href="supprimer.php?id='.$resultat['id'].'"><font color="#ffffff"><u>Supprimer</u></font></a></td>';




echo '</tr>';
}

echo '</table>';

$var = $resultat;

if($var == null){


echo "Aucune référence trouvée";


}



?>
<div id="cat-footer"></div>
</div>

</body></html>

<?php
mysql_close();
?>