Voila le message d'erreur:
Notice: Undefined index: interet in c:\documents and settings\propriétaire\mes documents\tests php\tests php\montranimo.php on line 17
Notice: Undefined variable: result in c:\documents and settings\propriétaire\mes documents\tests php\tests php\montranimo.php on line 26
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\documents and settings\propriétaire\mes documents\tests php\tests php\montranimo.php on line 26
Voilà le code en question: 
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
| <html>
<body topmargin="0" marginheight="0">
<?php
include("misc.inc.php");
$connection = mysql_connect($host,$user,$password)
or die ("Connection au serveur impossible");
$db = mysql_select_db($database,$connection)
or die ("Sélection de la base de données impossible");
//Sélection des animaux d'une catégorie donnée
$query = "SELECT * FROM Animal
WHERE animalType=\"{$_POST['interet']}\"";
//Affiche les résultat dans un tableau
echo "<table cellspacing='10' border='0' cellpadding='0'
width='100%'>";
echo "<tr><td colspan='5' align='right'>
<i>Cliquez sur une image pour l'afficher en grand
</i><br><hr>
</td></tr>\n";
while ($ligne = mysql_fetch_array($result,MYSQL_ASSOC) )
{$f_prix = number_format($ligne['animalPrix'],2);
//Y a-t-il plusieurs couleurs?
$query = "SELECT * FROM Couleur
WHERE animalNom='{$ligne['animalNom']}'";
$result2 = mysql_query($query) or die(mysql_error());
$nbCouleurs = mysql_num_rows($result2);
// affiche une ligne pour chaque animal
echo "<tr>\n";
echo "<td>{$ligne['animalID']}</td>\n";
$nomAnimal = stripslashes($ligne['animalNom']);
echo "<td><font size='+1'><b>$nomAnimal</b></font></td>\n";
echo "<td>{$ligne['animalDesciption']}</td>\n";
//Affiche l'image s'il n'y a pas plusieurs couleurs
if ($nbCouleurs <=1)
{echo "<td><a href='../images/{$ligne['animalImage']}'
border='0'>
<img src='images{$ligne['animalImage']}' broder='0'
width='100' height='80'></a></td>\n";
}
echo "<td> align='center'>$f_prix </td>\n
</tr>\n";
//Affiche une ligne par couleurs si plusieurs couleur
if($nbCouleurs >1)
{ while ($ligne2 = mysql_fetch_array($result2,MYSQL_ASSOC))
{echo "<tr><td colspan=2> </td>
<td>{$ligne2['animalCouleur']}</td>
<td><a href='../images/{$ligne2['animalImage']}'
border='0'>
<img src='../images/{$ligne2['animalImage']}' border='0'
width='100' height='80'></a></td>\n";
}
}
echo "<tr><td colspan='5'><hr></td></tr>\n";
}
echo "</table>\n";
echo "<div align='center'>
<a href='catalogue.php'><b>Pour en voir d'autres</b></a>
</div>";
?>
</body>
</html> |
voilà la ligne 17:
Code : PHPWHERE animalType=\"{$_POST['interet']}\"";
la ligne 26:
Code : PHPwhile ($ligne = mysql_fetch_array($result,MYSQL_ASSOC) )
D'ou peut bien venir le message d'erreur?
Partager