score:2
you got syntax error
$sql = "select * from ".$depar" where fecha_id = '".$date"' and hora_id >= '".$ini"' and hora_id <= '".$fin"'";
^ ^ ^ ^
here here
also
mysql_*
functions are officially deprecated as of php 5.5 (released june 2013).
has been removed entirely as of php 7.0 (released december 2015), use mysqli_*
or pdo
for better readability, you can also use heredoc like below
$sql = <<<eof
select *
from `$depar`
where `fecha_id` = '$date' and
`hora_id` >= '$ini' and
`hora_id` <= '$fin'
eof;
/* above you can also use between
`hora_id` between '$ini' and '$fin'
*/
$mysqli = new mysqli("localhost", "my_user", "my_password", "database");
/* check connection */
if ($mysqli->connect_errno) {
printf("connect failed: %s\n", $mysqli->connect_error);
exit();
}
$output = array();
if ($result = $mysqli->query($sql)) {
/* fetch associative array */
while ($row = $result->fetch_assoc()) {
$output[] = $row;
}
/* free result set */
$result->free();
}
/* close connection */
$mysqli->close();
/*some error handling if array is empty*/
if(empty($output)){
/*
couldn't create plot,
*/
}
and in your highchart options
xaxis: {
// your will get [charid, charid2, charid2, ... ]
categories: <?php echo json_encode(array_column($output,'timechar_id'),json_numeric_check); ?>
},
and in series data
series: [{
name: 'lpz',
// your will get [id1, id2, id2, ... ]
data: <?php echo json_encode(array_column($output,'pingchar_id'),json_numeric_check); ?>
}]
Source: stackoverflow.com
Related Query
- Generating Highcharts from MySQL data with PHP does not work
- Highcharts code with same set of code/data works in PHP but does not work in JSfiddle
- Highcharts heat map does not work with a wide range of data values (min: 0, max: 5,000,000)
- Highcharts not being drawn in some cases when using data from MySQL (page elements created before database query complete?) PHP / MySQL
- HighCharts pie chart X-axies values are not displayed while trying to get data from MySQL database using PHP
- Bars does not show up when loading JSON encoded data from PHP in Highcharts
- Highcharts does not work with wicked_pdf
- Add dynamic data to line chart from mysql database with highcharts
- How to populate a Highcharts axis with string formatted data from a PHP array
- Highcharts (highstocks) tooltip does not work on latest firefox 64.0 with useHTML=true
- Generate highcharts from v-for not populating all graphs with data
- Highcharts with angularjs drilled down does not work
- Highcharts Highmaps the data does not match with polygons correctly
- HighCharts angular not working with dynamic data from Angular service
- how to make chart real time with 2 line and get data from php with highcharts
- Highcharts does not display years on Xaxis when data with NULL values
- Dynamic chart using Highcharts with data from MySQL database
- Populating Highcharts chart with data received from MySQL
- Highcharts Range Selector does not work with multiple series
- Highcharts - Pinch zoom does not work on chart with multiple y axes
- Highcharts Date.UTC does not work properly for real data
- Passing data from PHP array to Highcharts chart with JSON
- Highcharts with Public Google Spreadsheet does not work
- Highcharts live data update does not work
- Cannot get Highcharts to show in 3D with data from mysql database
- Highcharts populate the categories with live data from MySQL
- Highcharts with data from mysql database
- Highcharts data from MySQL / PHP
- Highcharts highstock plot with data from php
- Highcharts data series issue with ajax/json and PHP
More Query from same tag
- Highcharter deprecated function's output is different than suggested
- Highcharts Reflow Heavy Chart Lagging
- highcharts bar graph from json
- Calling Reset Zoom manually
- HighCharts Export Hide Scrollbars
- Reduce gap between plot area and actual chart in highcharts
- Highcharts (ng2-highcharts) gauge in Ionic
- highcharts canvas-tools: Cannot read property 'prototype' of undefined
- HighCharts Not Displaying Correctly
- Series Data in HighChart
- Get point by ID from highchart with multiple series
- maxPadding on highstocks
- Highcharts - Put different URL to each of data in donut-pie
- Convert grouped strftime time to integer
- Two pies, one legend with unique items (merge legends)
- Highcharts areaspline, not getting the default color for chart
- Highcharts: Looping JSON into Series Data
- highcharts and different yAxis for different categories
- Angular Highcharts 10 $digest() iterations reached when object is replaced
- Is there a way to get superscripts to show up in highchart exports
- Highcharts refresh tooltip on button click not working with boost modul
- highcharts with null data points
- How to change the point color to red that is lowest point plotted in the graph and 2nd issue is animation effect is not supporting in the ie10,ie8
- How can I avoid moving flags when mouseovered - highcharts
- How to load geojson file in asp.net mvc
- Highstock chart - issue with xaxis label
- Highstock chart doesn't show after it has been cleared
- How to delete and add new contents in html file by python
- "TypeError: c.slice is not a function" when trying to call a function within JQuery
- How to make scrollable plot area fill all chart's background area in highcharts?