RE: [PHP] Making a Loop.[Scanned]

From: Date: Wed, 12 Mar 2003 08:29:53 +0000
Subject: RE: [PHP] Making a Loop.[Scanned]
Groups: php.general 
Request: Send a blank email to php-general+get-139241@lists.php.net to get a copy of this message
Philip, I might be missing something but just looking at the top few lines of your code the $number variable has no value. The loop will run on howver many times corresponds to this value - with the value being null it's not going to run. You'll need to pass in a value from elsewhere. Michael Egan -----Original Message----- From: Philip J. Newman [mailto:newmanpj@philipnz.com] Sent: 12 March 2003 08:21 To: php-general@lists.php.net Subject: [PHP] Making a Loop.[Scanned] I have this code to make this form list $x amount of times. for ($i = 1; $i <= $number; $i++) { echo"<select name=\"$number\" size=\"1\">"; // LIST ALL PRODUCTS IN DATABASE. $sql = "SELECT * FROM products ORDER BY productCode ASC"; $sql_result = mysql_query($sql, $connection) or die ("Could not get Query"); while ($row = mysql_fetch_array($sql_result)) { $productCode=$row["productCode"]; echo "<option value=\"$productCode\">$productCode</option><br>"; } // END WHILE. echo"</select>"; } and it dose not work any help? ------ Philip J. Newman. Head Developer info@philipnz.com +64 (9) 576 9491 +64 021-048-3999 ------ Friends are like stars You can't allways see them, but they are always there. ------ Websites: PhilipNZ.com - Design. http://www.philipnz.com/ info@philipnz.com Philip's Domain // Internet Project. http://www.philipsdomain.com/ newmanpj@philipnz.com Vital Kiwi / NEWMAN.NET.NZ. http://www.newman.net.nz/ philip@newman.net.nz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#139241) next »