RE: [PHP] Table looking odd as a result of while loop?
| From: | Johnson, Kirk | Date: | Mon, 26 Feb 2001 21:56:59 +0000 |
| Subject: | RE: [PHP] Table looking odd as a result of while loop? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-41741@lists.php.net to get a copy of this message | ||
Is it because 1 % 3 is 0 with a remainder of 2? Looks like the code is doing
just what it is written to do. The "if" evaluates to true on the second
picture.
Kirk
-----Original Message-----
From: James, Yz [mailto:liljim@btconnect.com]
Sent: Monday, February 26, 2001 2:55 PM
To: php-general@lists.php.net
Subject: [PHP] Table looking odd as a result of while loop?
Hi all, This is probably something dumb I'm missing, but I am using the
following code:
echo "<table border=\"0\">\n";
echo "<tr>\n";
$photocount = 0;
while($row = mysql_fetch_array($result)) {
$smallpic = $row['smallpic'];
if (($photocount % 3) == 2) {
echo "</tr>\n<tr>\n";
}
(There are currently 8 pics that have been uploaded). As you can see that
the first row has returned just two columns. I'd like the photos to be
displayed in rows of three, and if there are only 8 pictures (or any othe
number that's not directly divisible by three) to be displayed on the last
row. At the moment it's doing it "upside down." Any ideas?