Try:
$i++;
if( $i % 3 == 0 ){
echo "</tr>\n<tr>\n";
}
b.
mysql
[EMAIL PROTECTED] wrote:
> I have a database that is names and addresses. I want to make a web page
> that will display those
> names and addresses in a table with 4 columns per row, as many rows as necessary.
>The little
> if statement below works to make 2 columns, but when I change the number to 3 or
>higher it no longer
> works properly - I get the 3 or more columns wrapped to look like multiple rows.
>(there's on long line,
> hopefully it will wrap properly).
>
> <?
> (html and connection lines snipped)...
> $sql = "select * from brochures";
> $result = mysql_query($sql);
> while ($row = mysql_fetch_array($result))
> {
> printf("<td>%s<br>%s<br>%s<br>%s<br>%s<br>%s, %s %s</td>\n", $row["Account"],
>$row["name"], $row["email"], $row["Address"], $row["Address2"], $row
> ["City"], $row["State"], $row["Zip"]);
> if ($i % 2)
> {
> echo "</tr>\n<tr>\n";
> }
> $i++;
> }
> ?>
>
> --
> Chip W
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
--
Bill Adams
TriQuint Semiconductor
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php