Page 1 of 1

I have doubt

Posted: Tue Jun 24, 2014 2:03 am
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 |
+------------+-------+---------+---------+

Re: I have doubt

Posted: Tue Jun 24, 2014 7:39 am
by Celauran
OK. What have you tried and where are you getting stuck?

Re: I have doubt

Posted: Tue Jun 24, 2014 10:32 am
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.