I have a variable amount of 1 word text items being outputted from a mysql database query.
In order to make them presentable and spread in an aesthetic manner in the div, i figured i could put them into a table, this way no matter how many outputs i have, they will be sorted and organized.
I figured i can use php to pop the output into an array, and based on the number of elements in the array i can modify the formatting accordingly using control statements.
However upon doing some research i’ve heard it’s bad to use tables for formatting because i should keep content and layout separate.
Does that really apply in this case? If so, how could i make a desirable layout in a div when i dont know whether there will be 5, 10, or 20 elements?
Here is an example of how to put your query into a table.
you can set the amount of rows with the $cols variable