RE: [PHP] newbie algorithm help!!!!!
| From: | Jason Murray | Date: | Thu, 21 Jun 2001 06:17:32 +0000 |
| Subject: | RE: [PHP] newbie algorithm help!!!!! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-54682@lists.php.net to get a copy of this message | ||
> I wanna get them(i know how to do that) and list them in a
> 2-column table. I have been trying to use a loop to do it. But it
> will only produce a 1-column table. it's like
>
> entry 1
> entey 2
> entry 3
> entry 4
> etc
>
> Please help me so that i can get this :
>
> entry1 entry2
> entry3 entry4
Try this:
<?
echo "<TABLE>\n";
for ($i = 0; $i < num_rows($query); $i++ )
{
$row = mysql_fetch_array($query);
if ($i % 2)
{
echo "<TR>\n";
}
echo " <TD>$row[value]</TD>\n";
}
echo "</TABLE>\n";
?>