Page 1 of 1

Build logic for 2-column table?

Posted: Tue Feb 14, 2012 3:39 am
by marcushjortsberg
HI!

I am new to this forum so I say welcome to everyone to my life :D

I am having som trouble finding the logic in building a table...

I have a table like

<table><tr><td></td></tr></table>

In that table I list som categories with some things in each category, like

category1
thing1
thing2
thing3

category2
thing4
thing5

category3
thing6
thing7

category...
thing...

The number of categories and things is dynamic.

Now I want a table with 2 columns, like

<table>
<tr>
<td>category1
thing1
...
...</td>
<td>category2
thing3
...
</td>
</tr>
<tr>
<td>category3
thing5
...
...</td>
<td>category4
thing8
...
...</td>
</tr>

<tr>
<td>category...
thing...
...</td>
<td>category...
thing...
...</td>
</tr>
</table>

But I get confused when I try to build the logic...

Anyone who has slightly bigger brains than me?? 8)

Re: Build logic for 2-column table?

Posted: Tue Feb 14, 2012 1:24 pm
by G l a z z
Go to google and search for php two column table you should get some top results explaining you on how to achieve this.

Re: Build logic for 2-column table?

Posted: Wed Feb 15, 2012 8:49 am
by phpjawahar
Hi,

I hope this is the code you need !

Code: Select all

<table>
<tr>
 <td>Category1</td>
 <td>Category2</td>
 <td>Category3</td>
</tr>

<tr>
 <td>thing 1</td>
 <td>thing 1</td>
 <td>thing 1</td>
</tr>

<tr>
 <td>thing 2</td>
 <td>thing 2</td>
 <td>thing 2</td>
</tr>

<tr>
 <td>thing 3</td>
 <td>thing 3</td>
 <td>thing 3</td>
</tr>
</table>

With Regards,
Jawahar