I have doubt

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
jpradeep
Forum Newbie
Posts: 1
Joined: Tue Jun 24, 2014 2:01 am

I have doubt

Post by jpradeep »

Code: Select all

array(
    array(
        'Name' => 'Trixie',
        'Color' => 'Green',
        'Element' => 'Earth',
        'Likes' => 'Flowers'
        ),
    array(
        'Name' => 'Tinkerbell',
        'Element' => 'Air',
        'Likes' => 'Singning',
        'Color' => 'Blue'
        ),  
    array(
        'Element' => 'Water',
        'Likes' => 'Dancing',
        'Name' => 'Blum',
        'Color' => 'Pink'
        ),
);

I want output like this

Code: Select all

+------------+-------+---------+---------+
|    Name    | Color | Element |  Likes  |
+------------+-------+---------+---------+
| Trixie     | Green | Earth   | Flowers |
| Tinkerbell | Blue  | Air     | Singing |
| Blum       | Pink  | Water   | Dancing |
+------------+-------+---------+---------+
Last edited by Celauran on Tue Jun 24, 2014 7:39 am, edited 1 time in total.
Reason: Please use syntax tags to keep code legible.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: I have doubt

Post by Celauran »

OK. What have you tried and where are you getting stuck?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: I have doubt

Post by Christopher »

You want a table with a heading row and then data rows. You have an array of rows. Each row is an array of fields. So display the header row HTML, then loop through your array and create a HTML row with each row array.

If you don't know PHP very well, read about the foreach() loop in the PHP manual.
(#10850)
Post Reply