Does anyone have a way of creating columns from a mysql query. In other words, I have a hole lot of names that I need to display in 3 columns on one web page. How do I go about doing this?
Thanks in advance for any help.
Creating Columns
Moderator: General Moderators
I am not for sure....I was thinking that you had to display a certain amount of names in each column with a php script. So if I have a result of 30 names, and I want 10 names in each column.....
I do not think that this can be done in just plain html. I would need php to place 1-10 in $column1, 11-20 in $column2 and 21-30 in $column3.
Does this make anymore sense?
I do not think that this can be done in just plain html. I would need php to place 1-10 in $column1, 11-20 in $column2 and 21-30 in $column3.
Does this make anymore sense?
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
You need to count the results coming out and for every third one close the row and start a new one. As a starter try this code:
Mac
Code: Select all
for ($i = 1; $i <= 30; $i++) {
echo $i.' - ';
echo (($i%3) == 0) ? '<b>Third Result</b>' : '';
echo '<br />';
}