Results 1 to 2 of 2

Thread: PHP Array into table

  1. #1
    Join Date
    May 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PHP Array into table

    I have this code and want to organize it into a suitable table, how can I do this

    I have this code that I am confused about, I can get the outpoot into an array but I cannot organize it into a table, please help

    <META HTTP-EQUIV="REFRESH" CONTENT="20">
    <?php
    $xmlUrl = "https://secure.ifbyphone.com/ibp_api.php?api_key=6a9212f2af5a0ee41df847fd59eb63acf219404c&action=report.call_detail&start_date=20110517&end_date=20201231&format=csv&date_added=1&phone_label =1&dnis=1&ani=1&call_duration=1&transfer_to_number=1&call_type_filter=All"; // XML feed file/URL
    $xmlStr = file_get_contents($xmlUrl);
    $filearray = explode("\n", $xmlStr);
    while (list($var, $val) = each($filearray)) {
    ++$var;
    $val = trim($val);
    print "Line $var: $val<br />";
    $input =
    $cols = 5;

    echo "<table border=\"5\" cellpadding=\"10\">";

    for ($i=0; $i < count($input); $i++)
    {
    echo "<tr>";
    for ($c=0; $c<$cols; $c++)
    {
    echo "<td>$input[$i]</td>";
    }
    echo "</tr>";

    }

    echo "</table>";


    }

  2. #2
    Join Date
    May 2011
    Posts
    16
    Thanks
    1
    Thanked 1 Time in 1 Post

    Wink

    This line
    PHP Code:
    $xmlUrl "https://secure.ifbyphone.com/ibp_api.php?api_key=6a9212f2af5a0ee41df847fd59eb63acf219404c&action=report.call_detail&start_date=20110517&end_date=20201231&format=csv&date_added=1&phone_label =1&dnis=1&ani=1&call_duration=1&transfer_to_number=1&call_type_filter=All"// XML feed file/URL 
    Should be
    PHP Code:
    $xmlUrl "https://secure.ifbyphone.com/ibp_api.php?api_key=6a9212f2af5a0ee41df847fd59eb63acf219404c&action=report.call_detail&start_date=20110517&end_date=20201231&format=csv&date_added=1&phone_label=1&dnis=1&ani=1&call_duration=1&transfer_to_number=1&call_type_filter=All"// XML feed file/URL 
    There is a space which cuts off half the data.

    This line
    PHP Code:
    $input 
    Should be
    PHP Code:
    $input explode(',',$val); 
    Then its just a case of tweaking the output.

    I could rewrite it for you so it works and you just have to copy and paste it, but where's the fun in that .

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
  •