Re: Making a Loop.
| From: | Larry_Li at amat dot com | Date: | Wed, 12 Mar 2003 08:36:36 +0000 |
| Subject: | Re: Making a Loop. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-139243@lists.php.net to get a copy of this message | ||
Where is $number assignment? Because $number is ZERO, your code will not
run any statements in loop statement.
Larry
-----------------------------------------------------------------------------------------------------------------------
To: <php-general@lists.php.net>
cc:
"Philip J. Newman" Subject: [PHP] Making a Loop.
<newmanpj@philipnz.com>
03/12/03 04:20 PM
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