> $rows = $cols + ceil(($numdata-($cols*$cols))/$cols);
Seb suggested a much easier way:
$rows = ceil($numdate/$cols);
--
Chris Hobbs Silver Valley Unified School District
Head geek: Technology Services Coordinator
webmaster: http://www.silvervalley.k12.ca.us/~chobbs/
post
Hmmm. No code, but I'm guessing you'll probably want to set the width of
the table to be int(sqrt(mysql_num_rows($results))), and then set up
your loops to place only that amount of cells across. Then just keep
going til you run out of data.
So in the example of 31, you'd set the number of column
Well it seems what you're trying to do is to set as square a table as you
can. So, take your number of entries and square root it. Now round it up.
Now divide the number of entries by that number and again round up. Now use
these two numbers to make the table. Should be pretty straighforward..
Or 5x6 and 1 over...
But if you want to minimise the number of blank fields, you could
determine a max number of columns (and a minimum number of colums) that
you want to display and calculate the number of blank fields for all
posibilities
combinations.
Choose the one that minimises the number o
> -Original Message-
> From: Ian Grant [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 25, 2001 11:28 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Re: Making a new row in HTML tables
>
>
> Yeah, but if I had 31,
> I'd want 6x5 and then 1 over, or something
What about 16? 2x8,