>----- Original Message -----
>From: "Denis L. Menezes" <[EMAIL PROTECTED]>
>Sent: Wednesday, February 12, 2003 9:43 AM
>Subject: [PHP] need help with a table please - sorry
>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?
Untested, but I think will do what you want:
<table width="800" border="0" cellspacing="0" cellpadding="3">
<tr>
<?php
$i=0;
while($row=mysql_fetch_array($result)){
$i=$i+1;
// if this is the 8th item in this row, end current row, & start another
if (0 == ($i %8)){
Print "</tr>\n<tr>";
}
Print"<td width=\"150\" >";
Print "<a href=\"findbycategory.php?"."CategoryId=".$row"CategoryId"]
."\"><font color=\"#000040\" size=\"2\">$row[CategoryName]</font></a>"."
";
Print "</td>";
}
// ?fill out last row if don't have 7 items?
if (0 != ($i %8)){
?>
<td><div align="center"> </div></td>
<?php
}
?>
</tr>
</table>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php