Hi, what you want to do is only echo the <tr> and </tr> every 7 loops
through the records.

Untested example:

<table>
<?
$i = 0;
$sql = "SELECT id FROM table name";
$result = mysql_query($sql);
while($myrow = mysql_fetch_array($result))
    {
    $i++;
    if($i == 1) { echo "<tr>"; }
    echo "<td>{$myrow['id']}</td>";
    if($i == 7) { echo "</tr>"; $i = 0; }
    }
?>
</table>


Justin


on 19/12/02 4:27 PM, Bruce Levick ([EMAIL PROTECTED]) wrote:

> Hi php'ers,
> I have learnt alot in the last week in regards to php and listing the
> rows of a table set.
> 
> I need help with a small challenge. I can retrieve rows from a database
> table and list the results in HTML <tr> cell successfully. My challenge
> is this.
> 
> I want to list the I.D (auto increment id number) of a data base table
> in html to display 7 columns accross and then drop down to the next row
> and another 7 columns accross.
> 
> So the result would list numbers .1-7 then drop down and list 8-14
> underneath and so in until the end of the results.
> 
> Is this at all possible?? Difficult??
> 
> Is there a project or a tutorial with an example I can draw from.??
> 
> Cheers
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

Justin French
--------------------
http://Indent.com.au
Web Development & 
Graphic Design
--------------------


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to