How can I create a table in which columns and rows get added dynamically?
I forgot that famous tagline from a recent president, but in French I would sound something like "Mais oui, c'est possible" ...

The question here seems like a variation of something I recently ran into, related to processing log messages. One of the challenges with recent log messages (watchdog), is that there might be quite a few PHP notices, warnings, and errors that are filling up your logs. So a good practice is to identify / address these problems in your site (which will reduce the required resources for your site also and will result in a faster site).

However digesting these messages is quite a challenge. That's why I've come up with my own "custom" report, as illustrated in this screenprint:



Within the "Report Execution Parameters" (collapsed in the screenprint above), I specify the search criteria of the log messages to be retrieved (like severity, User name, etc). And the red numbers are hyperlinks to get a drill down report of the specific messages for which I want more details (= to display the actual watchdog entries).

Some more details about the above table:


Think of the columns (with headers starting with "Msg Type:...") as your "Task XX". While each row (= different message) is like your "User1", "User2", "User3".
If there wouldn't have been any errors with (say) "Msg Type: Ajax" or  "Msg Type: page not found", then the corresponding column wouldn't have been created.
Some columns (like "Msg Type: Error" or "Msg type: PHP") contain a value for multiple rows.


Refer to my answer to "How to gets analyts and generate visual reports from sessions?" for more details about creating reports (tabular displays) as in the above screenprint.

Just in case anybody wonders "How did you do that?" (without checking out my answer in the above link): There's a module for it ... it's called Forena ... And the clue in this specific case is to use Forena to create a "Crosstab table".

Bottomline: no need to re-invent the wheel ...

Disclosure: I'm a co-maintainer of the Forena module.