SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Aug 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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

  2. #2
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,408
    Mentioned
    45 Post(s)
    Tagged
    12 Thread(s)
    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:
    PHP Code:
    foreach ($results as $row)
    {
        
    $applications[] = $row['application'];
        
    $user_count[] = $row['user_count'];



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •