Bonjour,
voila j ai un fichier php qui marche sans probleme sauf que j ai deux echo qui saffiche tout le temps
if(isset($req2))
{
echo ("L'insertion a été correctement effectuée") ;
echo '<br><a href="cat-haa_modif.php">Retour sur les labels</a></br>';
}
et
echo "Aucune référence trouvée";
alors que
if(isset($req3))
{
echo ("Suppression ok") ;
echo '<br><a href="cat-haa_modif.php">Retour sur les labels</a></br>';
}
ne affiche qu au bon moment
savez vous pourquoi ?
je vous laisse tout le code je suis eprdu
<?php
include ('cat-haa/config.php');
include ('cat-haa/connexion.php');
{
$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();
?>
Afficher la suite
25 mars 2009 à 20:29
25 mars 2009 à 20:34