try using $count=0; before the loop (while loop is fine)
then before the end of the loop $count++;
inside the loop if ($count % 4) {
that is where you want it to break and start running the other code
}

so you would have 
$table = "<table>";
$counter = 0;
while ($tableset = mysql_fetch_array($result) ) {
$table = "<table>";
if ($counter % 4 == 0) {
$table .= "<tr> <td>FILE 0</td> <td>FILE 1</td> <td>FILE 2</td> <td>FILE 3</td> </tr>";
} else {
$table .= "<tr> <td>FILE 4</td> <td>FILE 5</td> <td>FILE 6</td> <td>FILE 7</td> </tr>";
}
$counter++;
}
$table .= "</table>";

something like that, if this doesnt get the total desired result try playing with the 
% 4 == 0 to
like == 1 or 2, see if that gets a desired result.  please please this is some psudo 
code I threw
together you might need to tweek.
--- Steve Maroney <[EMAIL PROTECTED]> wrote:
> 
> Hey guys,
> 
> I cant figure out what functions and/or looping I need to use for what I
> need to do. Im reading a directory and pushing all the file names in the
> directory into an arrary.
> 
> I want to be able print out each element(file name) in the array into an
> HTML table while limiting a certain number of elements for each row.
> 
> Example:
> $image_dir = opendir("../images/bullets/");
> while ($file = readdir($image_dir)) { $file_list[] = $file; };
> 
>  Now $file_list[] has some number a file names. I want print 4 file names
> into a row. Each file name has to be in its on cell.
> 
>  <table>
>   <tr> <td>FILE 0</td> <td>FILE 1</td> <td>FILE 2</td> <td>FILE 3</td> </tr>
>   <tr> <td>FILE 4</td> <td>FILE 5</td> <td>FILE 6</td> <td>FILE 7</td> </tr>
>  </table>
> 
> I would image I would use a for loop, but I cant figure it out.
> Can somone assist me ?
> 
> Thanks,
> Steve
> 
> 
> -- 
> 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]
> 


=====
Dan McCullough
-------------------------------------------------------------------
"Theres no such thing as a problem unless the servers are on fire!"
h: 603.444.9808
w: McCullough Family
w: At Work

__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

-- 
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]

Reply via email to