hrm..loop trouble

From: Date: Wed, 19 Sep 2001 19:25:31 +0000
Subject: hrm..loop trouble
Groups: php.general 
Request: Send a blank email to php-general+get-67888@lists.php.net to get a copy of this message
i'm trying to get a chunk of code to look 5 times then print something..then look 5 time more.... I really want to loop 5 times (making 5 cells) then print </tr><tr>then loop 5 more times for 5 cells...until the count is reached....like if i have 22 things i want to have 4 rows of five and one row of two...get what i'm trying to do? heres the code that i have so far <?php while ($arraycnt <= (count ($typearray)-1)){ $type = $typearray[$arraycnt]; //grab a first chair in array $sqlquery = "SELECT * FROM chairs WHERE type = '$type'"; //construct sql query $result=mysql_query($sqlquery,$db); while ($tempcnt <= 5){ print "<tr bgcolor=\"#ffffff\">"; while ($myrow = mysql_fetch_array($result)) { print "<td align=\"center\"><img src=\"/img/thumbs/".$myrow[modelnum]."_1.gif\" border=\"0\" alt=\"\"><br>Model $myrow[modelnum]</td>"; } //close cell loop $tempcnt++; print "</tr>"; } //close second while loop $arraycnt++; } //close first while loop ?> look at http://www.strawhillchairs.com/cat/index.php to see what i'm trying to do....

« previous php.general (#67888) next »