Re: Undefined constant error

From: Date: Mon, 30 Sep 2002 00:02:56 +0000
Subject: Re: Undefined constant error
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-118131@lists.php.net to get a copy of this message
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>"; > ?>

« previous php.general (#118131) next »