need help with a table please - sorry

From: Date: Wed, 12 Feb 2003 14:43:30 +0000
Subject: need help with a table please - sorry
Groups: php.general 
Request: Send a blank email to php-general+get-135310@lists.php.net to get a copy of this message
Hello friends. Sorry I sent the wrong code in my last mail. Here is my correct code. I want the output of my query to be formatted such that after every 7th output, the 8th one should start on a new row in the table. I have written the following code but does not work. Can someone please help? Quote : <table width="800" border="0" cellspacing="0" cellpadding="3"> <tr> <?php $i=0; while($row=mysql_fetch_array($result)){ $i=$i+1; if ($i==7){ Print "</tr><tr>"; Print"<td width=\"150\" >"; Print "<a href=\"findbycategory.php?"."CategoryId=".$row["CategoryId"] .."\"><font color=\"#000040\" size=\"2\">$row[CategoryName]</font></a>"." "; Print "</td>"; }else{ Print "<tr>"; Print"<td width=\"150\" >"; Print "<a href=\"findbycategory.php?"."CategoryId=".$row["CategoryId"] .."\"><font color=\"#000040\" size=\"2\">$row[CategoryName]</font></a>"." "; Print "</td>"; if ($i==6){ Print "</tr>"; }} } ?> <div align="center">&nbsp;</div></td> </tr> </table> Unquote. Thanks very much. Denis

« previous php.general (#135310) next »