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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:14:56+00:00 2026-06-16T07:14:56+00:00

I am stuck at data connect from mysql database to HighCharts highchart.js code below

  • 0

I am stuck at data connect from mysql database to HighCharts

highchart.js code below

            <script type="text/javascript">
    $(function () {
        var chart;
        $(document).ready(function() {
            chart = new Highcharts.Chart({
                chart: {
                    renderTo: 'container5',
                    plotBackgroundColor: null,
                    plotBorderWidth: 2,
                    plotShadow: false
                },
                title: {
                    text: '<p><?php echo $chart5; ?></p>'
                },
                // tooltip: {
                    // pointFormat: '{series.name}: <b>{point.percentage}%</b>',
                    // percentageDecimals: 1
                // },
               plotOptions: {
                    pie: {
                        allowPointSelect: true,
                        cursor: 'pointer',
                        dataLabels: {
                            enabled: false
                        },
                        showInLegend: true
                    }
                },


                    xAxis: {
             categories: [<?php echo "'".implode("','",$data)."'"; ?>]
          },
          series: [{
           type: 'pie',
             data: [<?php echo implode(",",$data1);  ?>] 

                }]
            });
        });

    });

        </script>

and my database.php:

            $data = array();
        $sql = "SELECT x_axis FROM licence_chart ";
         $result9 = mysql_query($sql);
                $data9 = array();
                while ($row = mysql_fetch_array($result9)) {
                   $data9 = $row['x_axis'];
                   $data[] = $data9;
                }

        $data1 = array();
        $sql = "SELECT y_axis FROM licence_chart ";
         $result10 = mysql_query($sql);
                $data10 = array();
                while ($row = mysql_fetch_array($result10)) {
                   $data10 = $row['y_axis'];
                   $data1[] = $data10;
                }

                echo "'".join("','",$data)."'";
                echo join(",",$data1);

when I run this code in localhost then pie chart shows but in x-axies values are not shown
that values are shown like Slice .but y-axies value are display correctly ,

in licence_chart table data like this in table x_axies, y_axies are columns

x_axies{crome,opera,ie,firefox,safari}
y_axies{0.12,0.23,23.2,56.2,2}

i want inhighchart.js file in data[]
data will come like this

['safari',10], ['firefox',1.5],[‘ie’,0.5]

so What am I doing wrong in database.php and highchatr.js file please tell me and correct my code .

  • 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-16T07:14:57+00:00Added an answer on June 16, 2026 at 7:14 am

    this correct answer for above question , i am using this and get above format

    <php
        $sql = "SELECT x_axis,y_axis FROM licence_chart ";
        $result9 = mysql_query($sql);
        $data9 = array();
        while ($row = mysql_fetch_array($result9)) 
            {
                $data9 = "'".$row['x_axis']."'".",".$row['y_axis'];
                $data[] = $data9;
            }   
        for($ii=0;$ii<count($data);$ii++)
            {
                echo "[".$data[$ii]."]," ;  
            }   
    ?> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am stuck in a strange issue while reading data from serial port in
Note: The Data schema can not be changed. I'm stuck with it. Database: SQLite
I'm writing a small PHP script to add some data in to a MySQL
I get an error trying to connect to my mysql database, I'm quite a
This is a bit from the query, a roster type database is looked at
Stuck with this particular issue. I have code that get lots of pages from
I have to return data fetched from MySQL table into a php file as
I am trying to display an entry from a MySql database which is selected
i am stuck with my first GCD and first core-data using application =) two
Kinda stuck here... I have an application with lets say 5000 rows of data

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.