I have a problem populating a table from a complex loop.

The table is composed of 7 days calendar table and each day should contain the day events under it.

```
Array
(
    [2012-12-16] => Array
        (
        )

    [2012-12-17] => Array
        (
            [0] => Array
                (
                    [date] => 2012-12-17
                    [time_booked] => 00:09:00
                    [time_start] => 00:00:00
                    [time_end] => 00:00:00
                    [name] => maha mostafa elrashed
                    [first_name] => marwan
                    [title] => root cannal
                )

            [1] => Array
                (
                    [date] => 2012-12-17
                    [time_booked] => 09:00:00
                    [time_start] => 00:00:00
                    [time_end] => 00:00:00
                    [name] => demo demo eldemo
                    [first_name] => marwan
                    [title] => ultrasound
                )

        )

    [2012-12-18] => Array
        (
            [0] => Array
                (
                    [date] => 2012-12-18
                    [time_booked] => 09:00:00
                    [time_start] => 00:00:00
                    [time_end] => 00:00:00
                    [name] => demo demo eldemo
                    [first_name] => marwan
                    [title] => root cannal
                )

        )

    [2012-12-19] => Array
        (
        )

    [2012-12-20] => Array
        (
        )

    [2012-12-21] => Array
        (
        )

    [2012-12-22] => Array
        (
        )

)

```

This example of array I want to convert into a table. currently I find the easiest way is to print each **day as ul and float left them**, but what I really want is to make a table out of them to be able to sort that table using jQuery in future.

```
foreach($ztable as $t){
    echo"\n<ul style='float:left;width:140px'>";
    foreach($t as $r){
        echo "<li class='{$r['first_name']}'>{$r['name']}</li>";
    }
        echo "</ul>\n";
}

```

Any suggestions?
I'm using Codeigniter 2 by the way

Edit:

![top table is from the suggested answer, the lower one is how I want it to be](https://i.stack.imgur.com/ECt6b.jpg)

Top table is from the suggested answer, the lower one is how I want it to be.