On Mon, 15 Jan 2001, Jerry Lake wrote:
> excuse my density today
> my brain is still in weekend mode
>
> how would I make this loop put 4 or 5 items (haven't decided)
> per line instead of just one item and the checkbox on each line?
>
> <snip>
> echo "<table border='1' cellpadding='2' cellspacing='2'>";
>
> while($myrow = mysql_fetch_array($result2))
> {
> $name = $myrow["name"];
> $personal_cost = $myrow["personal_cost"];
> $small_cost = $myrow["small_cost"];
> $large_cost = $myrow["large_cost"];
> $category = $myrow["category"];
>
> echo "<tr>";
> echo "<td>";
> echo $name;
> echo "</td>";
> echo "<td><input type=checkbox name=topping value=".$cost.">".$cost."</td>";
> echo "</tr>";
> }
> echo "</table>";
> </snip>
>
> Jerry Lake
>
Join the club :)
<?php
define('PERLINE', 4); // or 5, depending on taste
...
echo "<table border='1' cellpadding='2' cellspacing='2'>";
echo "<tr>";
$i=0;
$numrows=mysql_num_rows($result2);
while($myrow = mysql_fetch_array($result2))
{
++$i;
...
echo "<td>";
...
echo "</td>";
if (!($i%PERLINE) and ($numrows!=$i))
{
echo("</tr><tr>");
};
};
echo "</tr>";
echo "</table>";
?>
--
Ignacio Vazquez-Abrams <[EMAIL PROTECTED]>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]