@ 2015-12-10T15:00:48Z <?php
// variable
$table_name = 'Rendisk Circular Ikea Delft';
$table = 'esync_tagshistory';
$rows = 250;
$data = "";
// connect to the database
$connection = mysql_connect('localhost','eSyncExport','Rendisk@2013');
mysql_select_db('esync',$connection);
// sending query will collect tag names of selected ewon
$result = mysql_query("SELECT ESYNC_TAGS.NAME, _date, ESYNC_TAGSHISTORY.Val FROM ESYNC_TAGSHISTORY INNER JOIN ESYNC_TAGS ON
ESYNC_TAGSHISTORY.TAGID=ESYNC_TAGS.ID WHERE ESYNC_TAGS.STATIONID=1 ORDER BY _date DESC LIMIT $rows");
if (!$result) {
die("Query to show fields from table failed");
}
$fields_num = mysql_num_fields($result);
echo "<h1>{$table_name} last $rows rows</h1>";
echo "<table border='3' cellpadding ='10'
<tr>";
// printing table headers
for($i=0; $i<$fields_num; $i++)
{
$field = mysql_fetch_field($result);
echo "<td>{$field->name}</td>";
}
// printing table rows
while($row = mysql_fetch_row($result))
{
$data = ",['".$row[1]."', ".$row[2]."]".$data;
echo "</tr>\n";
echo "<td rowspan ='1'>$row[0]</td>";
echo "<td rowspan ='1'>$row[1]</td>";
echo "<td rowspan ='1'>$row[2]</td>";
//echo $data;
}
mysql_free_result($result);
//echo "</TABLE>";
$data = "['Date', 'Value']".$data;
//echo $data;
?>
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
<?php echo $data; ?> ]);
var options = {
title: '<?php echo $table_name;?>',
vAxis: {title: "On/Off"},
hAxis: {title: "Time"},
seriesType: "line",
series: {5: {type: "line"}}
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["table"]});
google.setOnLoadCallback(drawTable);
function drawTable() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Name');
data.addColumn('string', 'Date');
data.addColumn('boolean', 'Value');
dataata.addRows([
['Rij 1', 'Waarde 1'],
['Rij 2', 'Waarde 2'],
['Rij 3', 'Waarde 3'],
]);
var table = new google.visualization.Table(document.getElementById('table_div'));
table.draw(data, {showRowNumber: true});
}
</script>
</head>
<body>
<div id="table_div"></div>
</body>
</html>
<meta http-equiv="refresh" content="60">
</head>
<body>
<div id="chart_div" style="width: 100%; height: 700px;"></div>
</body>
</html>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.0.0 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /in/lQVso:9
Stack trace:
#0 {main}
thrown in /in/lQVso on line 9
Process exited with code 255 . Output for 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 Fatal error: Call to undefined function mysql_connect() in /in/lQVso on line 9
Process exited with code 255 . preferences:dark mode live preview
266.49 ms | 402 KiB | 327 Q