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

  • Home
  • SEARCH
  • 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 9072957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:17:55+00:00 2026-06-16T18:17:55+00:00

My php code produce something like that with this link getPower.php?year=2012&country=tr Kasan:[[1,50]] Tasan:[[1,51],[2,52],[3,52]] Hasan:[[1,50]]

  • 0

My php code produce something like that with this link getPower.php?year=2012&country=tr

"Kasan":[[1,50]]
"Tasan":[[1,51],[2,52],[3,52]]
"Hasan":[[1,50]]
"Masan":[[1,51],[2,52],[3,52]]

With this code;

$row = $result->fetch_assoc();

echo json_encode($row['teamName']). ":" ;

putPowerbyTeam($db,$row['teamID'],$year); //End with echo "json_encode($returnArray);"  

echo "\n";

And I’m trayin to convert them into JavaScript Object with this code;

$.ajax({type: "GET",
url: "getPower.php",
data: {year : "year", country : "country"},
success: function(JSONText) {

    var lines = JSONText.split('\n');

    $.each(lines,function(lineNo,line)
                    {
        var mainItems = line.split(':');
        chart.series[lineNo].name = jQuery.parseJSON(eval(mainItems[0]));
        chart.series[lineNo].setData(jQuery.parseJSON(eval(mainItems[1])), true);
    });

},
error: function (xhr, ajaxOptions, thrownError) {
    alert(xhr.status);
    alert(thrownError);
}

I’m an error which say cannot split the null. So, null is returned but i can’t be sure any part of this javascrip code.

So, why null is returned?
What can i do?
Is the rest is good?

  • 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-16T18:17:56+00:00Added an answer on June 16, 2026 at 6:17 pm

    Don’t try to build your JSON with multiple echo and json_encode. Use one big associative array and then echo json_encode(array).

    Something like this :

    $array = array();
    
    $teamName = $row['teamName'];
    
    $array[$teamName] = putPowerbyTeam($db,$row['teamID'],$year); // Return the array instead of doing json_encode($returnArray);
    
    echo json_encode(array);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

PHP code: echo date(c); //out put like this 2012-06-19T20:37:44+05:30 echo date(d M, Y); //out
I want to rewrite http://website.com/?slug=product_info.php&products_id=32 to http://website.com/product_info/32 and I use this code, add_filter('rewrite_rules_array','wp_insertMyRewriteRules'); add_filter('query_vars','wp_insertMyRewriteQueryVars');
So what I am trying to produce is something like this: Except, I do
I've been looking for something like this (that works of course) for YEARS now.
I am creating a form designer. It will generate PHP code which will produce
I'm learning PHP. The PHP has inline commands in HTML code to produce dynamic
there are some code as this: <div class=test> <div class=upsell-tags> <?php echo $this->getChildHtml('product_additional_data') ?>
I know that this question might have been asked like 100 times, but, believe
I was working on a simple link that would initiate an ajax call. This
Does anybody has any reference to the code in PHP that calculating time difference

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.