Build logic for 2-column table?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
marcushjortsberg
Forum Newbie
Posts: 5
Joined: Fri Apr 08, 2011 5:21 am

Build logic for 2-column table?

Post 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)
G l a z z
Forum Newbie
Posts: 24
Joined: Sun Feb 12, 2012 10:33 pm

Re: Build logic for 2-column table?

Post 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.
phpjawahar
Forum Newbie
Posts: 19
Joined: Thu Jan 12, 2012 6:06 am
Location: Chennai, India

Re: Build logic for 2-column table?

Post 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
Post Reply