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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T01:55:22+00:00 2026-05-21T01:55:22+00:00

I followed the wiki artichle (http://codeigniter.com/wiki/gchart/revision/5312/) to practice google chart in my CI 2.0.

  • 0

I followed the wiki artichle (http://codeigniter.com/wiki/gchart/revision/5312/) to practice google chart in my CI 2.0.
But it doesn’t work.

controller file: ci\application\helpers\mytest.php

$this->load->helper( 'gchart' );
$this->load->view('my_test');

view file: ci\application\helpers\my_test.php

$encoded_data = extendedencode(array(0, 1, 2, 3, 4, 5, 6) &maxvalue;);
echo <<< EOS
     <img src="
        http://chart.apis.google.com/chart?
            cht=lc
            &chs=250x250
            &chd;:e{$encoded}
        "
        alt="line graph of some example data" />
EOS;

help file: ci\application\helpers\gchart_helper.php

// I do copied all the source code from the wiki url link above.

When I try to charted by CI.
It showed error as this,
Parse error: syntax error, unexpected ‘;’ in C:\xampp\htdocs\demo\ci\application\views\my_test.php on line 54

Any thing wrong on my operation?
I compared the extendedencode() from gchart_helper.php

function extendedencode($data, &$maxvalue='notspecified')

and extendedencode() from my_test.php

$encoded_data = extendedencode(array(0, 1, 2, 3, 4, 5, 6) &maxvalue;);

Then I updated the extendedencode() line to this in my_test.php view file,

$encoded_data = extendedencode(array(0, 1, 2, 3, 4, 5, 6), &maxvalue);

And try again, but still get this error below.

Parse error: syntax error, unexpected ‘)’, expecting T_PAAMAYIM_NEKUDOTAYIM in C:\xampp\htdocs\demo\ci\application\views\my_test.php on line 54

Any help or comments are great appreciated.

[updated]

When I use the formated below, 

$encoded_data = extendedencode(array(0, 1, 2, 3, 4, 5, 6) &maxvalue);

showed another four error message.



Events List

A PHP Error was encountered

Severity: Notice

Message: Use of undefined constant maxvalue - assumed 'maxvalue'

Filename: views/my_test.php

Line Number: 54

A PHP Error was encountered

Severity: Warning

Message: max() [function.max]: When only one parameter is given, it must be an array

Filename: helpers/gchart_helper.php

Line Number: 49

A PHP Error was encountered

Severity: Warning

Message: Division by zero

Filename: helpers/gchart_helper.php

Line Number: 55

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: encoded

Filename: views/my_test.php

Line Number: 61

[Updated against Frank’s suggestion]

There are still two errors occurred below,

A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 64

Filename: helpers/gchart_helper.php

Line Number: 65  // code line: $ret .= $grid[$x].$grid[$y];


A PHP Error was encountered

Severity: Notice

Message: Undefined variable: encoded

Filename: views/my_test.php

Line Number: 61 // code line: &chd;:e{$encoded}
  • 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-21T01:55:23+00:00Added an answer on May 21, 2026 at 1:55 am

    Alex’s answer isn’t syntactically correct. Try:

    $encoded_data = extendedencode(array(0, 1, 2, 3, 4, 5, 6), $maxvalue);
    

    The & in the function documentation just tells you that your variable will be used by reference. You shouldn’t (and in fact cannot) include the & when you call the function. In older versions of PHP, there was a feature called call-time pass by reference, in which you’d use syntax like that, but it’s disallowed in recent versions.

    Edit:

    Regarding one of the additional errors you’ve listed: as the error says, there’s no $encoded var in the code you’ve shown us. Try replacing &chd;:e{$encoded} with &chd;:e{$encoded_data} — I’m guessing that might be what you intended.

    A sloppy method of silencing the final error would be to replace $ret .= $grid[$x].$grid[$y]; with $ret .= @$grid[$x].@$grid[$y];. Without additional context for the code in play there, it’s hard to say what the actual root issue is there.

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

Sidebar

Related Questions

I have followed the instructions found at http://code.google.com/p/pubsubhubbub/wiki/DeveloperGettingStartedGuide to setup a hub. When I
I followed all of the instructions so far from: http://code.google.com/p/appengine-jruby/wiki/RunningRails and http://gist.github.com/268192 Currently, I'm
I followed this tutorial: http://codeigniter.com/wiki/Internationalization_and_the_Template_Parser_Class/ The controller that loads the language is this one:
I followed the installation here: http://code.google.com/p/chromedevtools/wiki/DebuggerTutorial I installed them on both machines, and it
I followed the instructions for adding ACRA to my project as follows: http://code.google.com/p/acra/wiki/BasicSetup Aside
I try to access information from Twitter and I followed this link: http://code.google.com/p/sociallib/wiki/SocialLibGuide I
I followed this tutorial: https://github.com/EllisLab/CodeIgniter/wiki/PDF-generation-using-dompdf However, I can't seem to set the path right.
I followed the tutorial at http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/installing_custom_attributes_with_your_module step by step to make my module install
I'm on shared server environment (Dreamhost.com uses Linux/Debian). I followed their instructions @ http://wiki.dreamhost.com/Advanced_PHP_configuration
I followed this link http://wiki.developerforce.com/page/Getting_Started_with_the_Mobile_SDK_for_iOS#Working_with_the_SDK to as to integrate my iOS App with the

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.