Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6327143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:13:33+00:00 2026-05-24T17:13:33+00:00

On a website I am working on as a project I have a table

  • 0

On a website I am working on as a project I have a table which has 3 columns,

Column 1: Artist
Column 2: Times Played this week
Column 3: Previous Plays

Then problem with this is that the table is very long and it takes a little while to scroll to the bottom (well, more time than the user will give).

I want it to be in this layout and have 6 columns, or two seperate tables:

Column 1: Artist
Column 2: Times Played this week
Column 3: Previous Plays
(little space to break the 3 columns each side up)
Column 4: Artist
Column 5: Times Played this week
Column 6: Previous Plays

The link to page with the current table is below:

LINK

The PHP code im using top generate the table and its contents is:

<?php
$xml_data = file_get_contents('http://www.bbc.co.uk/programmes/music/artists/charts.xml');
$xml = new SimpleXMLElement($xml_data);
?>

<table>
<th>Artist</th>
<th>Times played this week</th>
<th>Previous plays</th>

<?php
foreach ($xml->artists->children() as $child)
{
  echo "<tr>";
  $artist = (string)$child->name;
  echo "<td>$artist</td>";
  $playedweek = (string)$child->plays;
  echo "<td>$playedweek</td>";
  $previousplays = (string)$child->previous_plays;
  echo "<td>$previousplays</td>"; 
  echo "</tr>";
}?>
</table>

The CSS I am using for the table is:

table {
text-align: center;
}
td {
    border-right: 1px solid #C1DAD7;
    border-bottom: 1px solid #C1DAD7;
    background: #fff;
    padding: 6px 6px 6px 12px;
    color: #6D929B;
}

I have tried to include all the necessary code that you may need. If im missing something ill add it upon request.

How can I achieve what I described above?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:13:34+00:00Added an answer on May 24, 2026 at 5:13 pm

    If you have an option to replace table with any other element then:

    Render the info as a list and then give the li elements a float with left as the value and the width as 16.6%

    e.g:

    <?php
    $xml_data = file_get_contents('http://www.bbc.co.uk/programmes/music/artists/charts.xml');
    $xml = new SimpleXMLElement($xml_data);
    ?>
    
    <ul>
    <li>Artist</li>
    <li>Times played this week</li>
    <li>Previous plays</li>
    <li>Artist</li>
    <li>Times played this week</li>
    <li>Previous plays</li>   
    <?php
    foreach ($xml->artists->children() as $child)
    {
      $artist = (string)$child->name;
      echo "<li>$artist</li>";
      $playedweek = (string)$child->plays;
      echo "<li>$playedweek</li>";
      $previousplays = (string)$child->previous_plays;
      echo "<li>$previousplays</li>"; 
    }?>
    </ul>
    

    CSS:

    li
    {
        float: left;
        width: 16.6%;
    }
    

    Sample HTML @: http://jsfiddle.net/yT6P5/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on project, to make a website which read files(c/c++ text
I've got this ASP.NET 2.0 website project in Visual Studio that I've been working
I am working on a project where I have to defend the website against
I am working on Project where I have JQuery 1-Page Horizontal scrolling website using
I'm working on a Website Project (as opposed to an ASP.NET Web Application) which
I'm working on a website project and I have a paragraph containing a list
I am working with asp.net website project that some of pages need authentication. I
I'm working on a small (java) project where a website needs to maintain a
I'm working on an ASP.Net project to display information on a website from a
I am working on an ASP.NET project which is physically located at C:\Projects\MyStuff\WebSite2. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.