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 8692923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:25:27+00:00 2026-06-13T00:25:27+00:00

I’ve a php script which loads basically just one csv via: echo json_encode(file(csvfile.csv, FILE_IGNORE_NEW_LINES));

  • 0

I’ve a php script which loads basically just one csv via:

echo json_encode(file(csvfile.csv, FILE_IGNORE_NEW_LINES));

The output is something like this:

[“foo,bar,baz”,”foo, foo,bar”,”bla,bla,blubb”]

In my basic html file I load it in this way:

 $(document).ready(function(){
    $.getJSON("curlcsvfetcher.php", function(data) { 
    $('#data').empty();
    var columnseperator     =  "|";
    var commentindicator    = "#"; 
    var textqualifier   = '"' 
    filltable2(data,columnseperator,commentindicator,textqualifier); }
 );

This works great with the function filltable() but not with filltable2():

function filltable(data,columnseperator,commentindicator,textqualifier){
    var table_obj = $('table');
    $.each(data, function(index, item){
         table_obj.append($('<tr id="'+item+'"><td>'+item+'</td></tr>'));
    }).insertAfter('.table');
} 
function filltable2(data,columnseperator,commentindicator,textqualifier){
    var table_obj = $('table');
    var trstart = '<tr>';
    var trend = '</tr>';
    $.each(data, function(index, item){
        table_obj.append($('<tr id="'+item+'"><td>'+item+'</td></tr>'));
        var columns = data.split(columnseperator);
        var tddata = '';
        for (var column in columns){
            tddata = tddata +'<td>'+column+'</td>';
            }
        var rowdata = trstart + tddata + trend;
        table_obj.append($(rowdata));

    }).insertAfter('.table');
} 

The function filltable() generate the output with one column and 3 rows.
But now I want to explode each line in (this case 3) columns.

There must be a problem with my code in function filltable2() and I don’t know what I am doing wrong.

The output of filltable2() is just one line in the table.

Thank you very much!

PS: This problem is related to my last question but I think the basic problem is unrelated, so i created a new question

  • 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-06-13T00:25:28+00:00Added an answer on June 13, 2026 at 12:25 am

    I think it’s because in the split line, you’re giving it:

    data.split(columnseperator);
    

    When you mean

    item.split(columnseperator);
    

    or

    data[index].split(columnseperator);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have an autohotkey script which looks up a word in a bilingual dictionary
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a small JavaScript validation script that validates inputs based on Regex. I
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,

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.