problem with for loop...help....

From: Date: Thu, 14 Sep 2000 13:48:06 +0000
Subject: problem with for loop...help....
Groups: php.general 
Request: Send a blank email to php-general+get-16771@lists.php.net to get a copy of this message
I am trying to format a table with 2 columns and as many rows as the array requires, but with the following code it appears that the for loop is not working... I have looked all over for a bertter understanding of the for loop. Any ideas here what is wrong with this code.... echo "<table border=1>"; while($row1 = mysql_fetch_array($sql_result1)) { $item_type = $row1["html_value"]; $sql_count = "SELECT COUNT(item_type) ourcount FROM products WHERE item_type = \"$item_type\""; $sql_count_result = mysql_query($sql_count, $connection); echo "<tr>"; for ($i = 0; $i < 1; $i++) { while($row1 = mysql_fetch_array($sql_count_result)) { $item_count = $row1["ourcount"]; echo "<td>$item_type ($item_count)</td>"; } } echo "</tr>"; } echo "</table>";

« previous php.general (#16771) next »