Showing Multiple rows from sql table as single row on web page

I am trying to create a webpage to show application user count.
The output file shows this in a csv but I don’t know how I would show the application name on one row and the count on another.

SQL table

Insphire 173 24/07/2013 14:00:31
Nav 5 119 24/07/2013 14:00:31
1C 6 24/07/2013 14:00:31

Want to show

Insphire Nav 5 1C
173 119 6

Loop through the DB results and put the data into two separate arrays that you can use when you build your output, something like this:


foreach ($results as $row)
{
    $applications[] = $row['application'];
    $user_count[] = $row['user_count'];
}