0
I have the following code in PHP, this code causes you to search the Mysql data and show in a graph in the HTML view.
The problem is that the data is not shown on the screen for viewing the end user.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src='http://code.highcharts.com/highcharts.js' type='text/javascript'> </script>
<script src='http://code.highcharts.com/modules/exporting.js' type='text/javascript'> </script>
</head>
<body>
<?php
//error_reporting('0');
$con = mysql_connect('localhost', 'root', '') or die('Error connecting to server');
mysql_select_db("financeapp", $con);
$SQL1 = "SELECT * FROM highcharts";
$result1 = mysql_query($SQL1);
$data1 = array();
while ($row = mysql_fetch_array($result1)) {
$data1[] = $row['datehigh'];
}
$result2 = mysql_query($SQL1);
$data2 = array();
while ($row = mysql_fetch_array($result2)) {
$data2[] = hexdec($row['conteudo']);
}
?>
<script type="text/javascript">
$(document).ready(function() {
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'line'
},
title: {
text: 'Comming Data'
},
xAxis: {
categories: ['<?php echo join($data1, "','") ?>'],
},
yAxis: {
min:0,
},
legend: {
layout: 'vertical',
backgroundColor: '#FFFFFF',
align: 'left',
verticalAlign: 'top',
x: 50,
y: 35,
floating: true,
shadow: true
},
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
series: [ {
name: 'Data',
data: ['<?php echo join($data2, "','") ?>'],
// pointStart: 0
//pointInterval
},
]
});
});
</script>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
can you post the generated page source code after processing your PHP script? may be that the content returned from your query is generating your problem, but since I obviously don’t have access to your database, I can’t test to confirm
– Marcelo Bezerra bovino
Worth a read on this help center topic: How to create a Minimum, Complete and Verifiable example. Always try to create a simple example and include it in the body of the question.
– bfavaretto
Thank you for the information.
– the flash