-1

* Im still a newbie to this so please go easy on me :) * Can someone fix and explain these for me? I can't really understand JSON since Im still new to it? Would really appreciate it very much. Thanks!

if ($result) {

  // creating an associative array to store the chart attributes        
  $arrData = array(
    $chart = array(
      $theme = "fint",
      $caption = "Browser Market Share",
      $subcaption = "February 2016",
      $captionFontSize = "24",
      $paletteColors = #A2A5FC, #41CBE3, #EEDA54, #BB423F #,F35685,
      $Font = "Quicksand, sans-serif",
      //more chart configuration options
    )
  );

  $arrData["data"] = array();

  // iterating over each data and pushing it into $arrData array
  while ($row = mysqli_fetch_array($result)) {
    array_push($arrData["data"], array(
      $label = $row["browser"],
      $value = $row["shareval"]
    ));
  }

  $jsonEncodedData = json_encode($arrData);

}


// Syntax for the instance -         
$var = new FusionCharts("type of chart", 
                "unique chart id", 
                "width of chart", 
                "height of chart", 
                "div id to render the chart", 
                "type of data", 
                "actual data")

// creating FusionCharts instance
$doughnutChart = new FusionCharts($doughnut2d, $browserShareChart , "100%", "450", "doughnut-chart", $json, $jsonEncodedData);

// FusionCharts render method
$doughnutChart=render();

// closing database connection      
$dbhandle=close();

?>
Rheys
  • 3
  • 3
  • 1
    You're missing a `;` to complete the `$var = new FusionCharts(...` statement, which is just before where `$doughnutChart` is assigned, and made it an unexpected variable. – Paul T. Feb 23 '20 at 19:20

1 Answers1

-1

You forget ; after FusionCharts statement. Put ; after this statement like this:

$var = new FusionCharts("type of chart", 
                "unique chart id", 
                "width of chart", 
                "height of chart", 
                "div id to render the chart", 
                "type of data", 
                "actual data");
Ankur Mishra
  • 1,284
  • 1
  • 6
  • 15
  • Please don't post answers only pointing out a typographical issue or a missing character. Such answers are unlikely to help future visitors since they are specific to OP's code. Instead, flag or vote to close the question as off-topic as per the [help/on-topic]. – Dharman Feb 25 '20 at 17:48
  • @Dharman ok sir. Do you have your own blog website and where you have learned about security related topics? – Ankur Mishra Feb 25 '20 at 18:25
  • I don't have a blog myself. You should follow the good experts. https://phpdelusions.net/ and https://paragonie.com/blog/2017/12/2018-guide-building-secure-php-software are some of the best experts. – Dharman Feb 25 '20 at 22:41