Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用PHP从MySQL数据生成Highcharts不起作用_Php_Mysql_Graph_Highcharts - Fatal编程技术网

使用PHP从MySQL数据生成Highcharts不起作用

使用PHP从MySQL数据生成Highcharts不起作用,php,mysql,graph,highcharts,Php,Mysql,Graph,Highcharts,非常感谢你的帮助 我试图从mysql数据库“log”中存储的数据生成highcharts折线图,该数据库有不同的表,每个表有5个字段:fecha_id(type date)、hora_id(type time)、ping_id(type float)、timechar_id(type varchar)和pingchar_id(type varchar)。我尝试使用POST方法选择要使用数据的表、日期和时间行,然后生成要使用的highcharts的有效数据,我尝试使用时间作为X轴,ping值作为y

非常感谢你的帮助

我试图从mysql数据库“log”中存储的数据生成highcharts折线图,该数据库有不同的表,每个表有5个字段:fecha_id(type date)、hora_id(type time)、ping_id(type float)、timechar_id(type varchar)和pingchar_id(type varchar)。我尝试使用POST方法选择要使用数据的表、日期和时间行,然后生成要使用的highcharts的有效数据,我尝试使用时间作为X轴,ping值作为y轴。 根据Deep3015的建议,我编辑了我的代码,以遵循highchart网站上发布的指南,更新后的代码是:


海图测验
Highcharts.chart('容器'{
图表:{
类型:“行”
},
标题:{
文本:“Ping stats”
},
副标题:{
文本:“登录MySQL”
},
xAxis:{
类别:[]
},
亚克斯:{
标题:{
文本:“时间单位[ms]”
}
},
打印选项:{
行:{
数据标签:{
已启用:true
},
enableMouseTracking:false
}
},
系列:[{
名称:“LPZ”,
数据:[]
}]
});
我仍然得到一张空白页。所以我想知道我做错了什么。
谢谢您的帮助。

您遇到语法错误

$sql = "select * from ".$depar" where fecha_id = '".$date"' and hora_id >= '".$ini"' and hora_id <= '".$fin"'";
                             ^                           ^                         ^                          ^                                                                      
                            Here                       Here
在你的海图选项中

xAxis: {
       // your will get [charid, charid2, charid2, ... ]
      categories: <?php echo json_encode(array_column($output,'timechar_id'),JSON_NUMERIC_CHECK); ?>
  },
xAxis:{
//你会得到[charid,charid2,charid2,…]
类别:
},
和串联数据

series: [{
        name: 'LPZ',

        // your will get [id1, id2, id2, ... ]
        data: <?php echo json_encode(array_column($output,'pingchar_id'),JSON_NUMERIC_CHECK); ?>
}]
系列:[{
名称:“LPZ”,
//您将获得[id1,id2,id2,…]
数据:
}]

忘记放置echo
修复了它,没有任何问题仍然没有控制台错误。选中Ok,这看起来很简单,按照链接给出的指导原则更新了我的代码,仍然没有任何内容。然后开始使用var_dump()或print_r()调试php变量。检查此变量是否有一些值。如果在php中使用,请删除错误报告(0)
xAxis: {
       // your will get [charid, charid2, charid2, ... ]
      categories: <?php echo json_encode(array_column($output,'timechar_id'),JSON_NUMERIC_CHECK); ?>
  },
series: [{
        name: 'LPZ',

        // your will get [id1, id2, id2, ... ]
        data: <?php echo json_encode(array_column($output,'pingchar_id'),JSON_NUMERIC_CHECK); ?>
}]