score:10

Accepted answer

I believe your problem is in the order you included the scripts. Try placing jQuery first:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"       type="text/javascript"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>

Demo (working / not working).

Update: to load your data from MySQL using PHP, please see this example. However, as you pointed out yourself, encoding it using JSON might be a better option:

$data = array();

while($row = mysql_fetch_array($results)) {
    $data[] = array($row[1], $row[0]);
}
echo json_encode($data);

This last echo can be used either to return the whole array using ajax (like the linked example above), or when generating the page itself (i.e. "hardcoding" it in the script):

    series: [{
        type: 'pie',
        name: 'Browser share',
        data: <?php echo json_encode($data)?> 
    }]

This will work since your array, when JSON encoded, can be used in place of a JavaScript literal (and the json_encode should take care of escaping everything, preventing XSS vulnerabilities).

score:5

The order of including javascripts should be:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"       type="text/javascript"></script> 
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>

By this I mean, you have to include the jQuery library first before any other script.


Related Query

More Query from same tag