php script that loads data from database
-
My Php Script is
<?php
global $wpdb;
$myrows=$wpdb->get_results(“SELECT answer FROM {$prefix}wp_modal_survey_answers”, ARRAY_A);
// Print it as JSON
foreach{$myrows as $key1
echo json_encode( $key1[‘answer’] );
}?>
I want to load data from the database to form chart.
On javascript section i am using this code
var %CHART% = AmCharts.makeChart(“%CHART%”, {
“dataLoader”: {
“url”: “http://www.abc.com/wp-content/themes/decor-child/data.php”,
“format”: “json”
},
“graphs”: [{
“valueField”: “answer”}]
});
ON Resources section i have used these files
http://www.amcharts.com/lib/3/amcharts.js
http://www.amcharts.com/lib/3/serial.js
http://cdn.amcharts.com/lib/3/plugins/dataloader/dataloader.min.jsIn HTML section
<div id=”%CHART%” style=”width: 100%; height: 300px;”></div>
but my chart is not appearing please suggest me solution
Thanks
The topic ‘php script that loads data from database’ is closed to new replies.