There seems to be a print-error in this book. It's missing a '$' This line: > if (compteur == 1) { should be: > if ($compteur == 1) {
Sascha Am Montag, 30. September 2002 01:52 schrieb Voisine: > Hello, > > I'm learning PHP from a book "PHP for newbie writen in French" and I > have an error on one of the exemple. Undifined constant 'compteur' on > line 15 which is : > if (compteur == 1) { > > What I'm doing wrong? This is the script > > <?php > include("config.inc.php"); > $query = "SELECT * FROM Type ORDER BY animalType"; > $result = mysql_query($query) or die ("Exécution de la sélection > impossible"); > > echo "<h1 align='center'>Catalogue</h1><p><h3>Quel type d'animal > cherchez-vous ?</h3>\n"; > echo "<form action='montre_animaux.php' method='post'>\n"; > echo "<table cellpadding='5' border='1'>"; > $compteur = 1; > while ($ligne = mysql_fetch_array($result)) { > extract($ligne); > echo "<tr><td valign='top' width='15%'>"; > echo "<input type='radio' name='interet' value='$animalType'>"; > if (compteur == 1) { > echo "checked"; > } > echo "<font > size='+1'><b>$animalType</b></font></td><td>$typeDescription</td></tr>"; > > $compteur++; > } > echo "</table>"; > echo "<p><input type='submit' name='submit' value='Faites votre > choix'></form>"; > ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php