|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
PHP -Output in table
Hello,
i posted this in PHP forum and someone told me to post it somewhere else. someone please help i have this code PHP Code:
it gives me output like subcategory1 subcategory2 subcategory3 subcategory4 subcategory5 subcategory6 subcategory7 subcategory8 subcategory9 how can i modify this to give output in a table to show it like subcategory 1 subcategory 5 subcategory 9 subcategory 2 subcategory 6 subcategory 10 subcategory 3 subcategory 7 etc. subcategory 4 subcategory 8 etc.. thanks in advance Hats |
|
#2
|
||||
|
||||
|
That WHOLE code just returns a list of subcategories?!? Yeez.. (didn't read it's too long imo
)First of all, I think this belongs in the PHP forum since it's (1) PHP and (2) more compicated than much stuff around there.. anyway.. General advice: KISS (Keep it simple, stupid) ![]() Start with an array with x elements and use it as the data you want to put in the table... Forget the database for now since that's just 'information', not 'structure'... Since tables are created by row and each row is created from left to right it's easier to order your subcategories like Quote:
If you want the order you mentioned you'll have to count the amount of subcats in the beginning. Check how much subcats remain if you devide it by X (X is the amount of columns). If the amount is dividable by X all columns will have the same amount of rows (Y), if not you'll need to make the columns 1 row longer then the number of times X 'fits' in the total amounts of subcats (being Y).... still following me?? ![]() Then create a table with 1 row and 3 cols. In the first cell you make another table with the subcats 1 to Y. In the second you make a table with the subcats Y+1 to 2Y etc... If the information of one of the subcat takes more place then another the total table will become 'messy'. Other solution would be to use a single table and calculate which subcat is supposed to be in each following cell: 1, Y+1, 2Y+1, 2, Y+2, 2Y+2 etc... Hope this is of some help ![]() Regards
__________________
There are 10 types of people in this world - those who understand binary and those who don't... PHP | MySQL | DevShed Forum Search | Google Search |
|
#3
|
|||
|
|||
|
Hi,
thank you for your reply first let me appologise, i found the solution from PHP forum, i should have posted it here for anyone who wants to use it here is the Link to the solution, person who told me to post this in somewhere else and not in PHP, actually wrote a function for me which gives output in the form i wanted Cheers! |
![]() |
| Viewing: Dev Shed Forums > Other > Beginner Programming > PHP -Output in table |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|