![]() |
Finish Table Columns With Number Divisibility Function
Well I'm working on a script where you must complete the table to look right or I might be missing a TD which I can't have, so I had this problem where I only had 9 results in the db and I needed to know how many more I needed to add(columns) to complete a four column table.
So: 1 2 3 4 5 6 7 8 9 | | | the |'s didn't display since I didn't know how to get the extra td's and came up with this function. PHP Code:
PHP Code:
|
Hmm shorter version:
PHP Code:
|
I dont get what you are trying to do. Are you trying to fill in the number of remaining TDs left from whatever you are doing? If so, do this
PHP Code:
|
I'm not trying to do nothing atm as I did it.
And yes I was doing that but in a different/shorter way I had a table with 4 columns and I had 9 results that had to fit in the table, SO I made this function to tell me how many columns are needed to make a complete 4 by # without leaving off a couple columns to make my table not be incomplete. And my function is shorter then using that code multiple times(repeated code) since I need this function 3 times in a class I'm creating for different table column sizes: PHP Code:
|
You could also calculate the remainder another way which negates the need to check for the case where the cells fit nicely into the grid. It's just another way of doing the same thing.
PHP Code:
|
| All times are GMT. The time now is 10:05 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0