View Single Post
Old 2005-05-13, 12:36 PM   #6
Barron
You tried your best and you failed miserably. The lesson is 'never try'
 
Join Date: Oct 2004
Posts: 166
Wow! Very different results using the two different ways of handling the round up.

In my first post I showed two snippets of code. The second snippet is what produces the table cells that will be sent to the browser. I didnt alter that part of the code. Here are the results of what happened:
Quote:
Quote:

$columns = (int) ($this_many_category_columns[0] + 0.5);
Using this, the number rounded down. But, the interesting part is that with 1-6 number of items I got the desired effect, 1 item in each of 6 columns. On the 7th item, I got 7 columns, but the 8th column was created with nothing in it. However, as I increased the number of items, every multiple of 7 gave me an extra column. By the time I got to 49 items in the list I recieved 13 columns. not good.
Quote:
Quote:

$columns=ceil($count_categories_build/7);
Using ceil(); the number did round up nd I "did not" get an extra column for every multiple of 7. (I eliminated 5 lines of code, not counting the bracket lines)However, for each mulitiple of 7 I did get a blank 8th column. If the number of items was not a multiple of seven, I didnt not get the desired effect. I recieved 6 columns, with overflow going to the 7th column. I am suppose to get 7 columns with the over flow in the eighth column.

I changed the 7 to a 6 and got different results. So experimented with different numbers. Every odd number produced the same results as any other odd number, and every even number produced the same results as any other even number.
Anyway, I thought it was interesting the way PHP handled the two different lines of code. All I need to do know is eliminate the column with nothing in it and that will be easy.

Sams and cd34, thanks for your help!


-
Barron is offline   Reply With Quote