-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
34 lines (28 loc) · 806 Bytes
/
Copy pathtest.php
File metadata and controls
34 lines (28 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
$host='localhost';
$dbname='vera';
$username='vera';
$password='vera$2012';
$days=365;
$series=array();
$db = mysql_connect($host, $username, $password);
mysql_select_db($dbname,$db);
$sql= 'select * from devices_mapping where category=17';
//echo $sql."\r\n";
$req=mysql_query($sql);
while ($device=mysql_fetch_object($req)){
echo $device->descr."\n";
$serie=array();
$sub_sql="select * from measures where device_id=".$device->local_id." order by ts desc limit 0,".$days*144;
//echo $sub_sql."\r\n";
/*
$sub_req=mysql_query($sub_sql);
while ($measure=mysql_fetch_object($sub_req)){
$serie[]=array(strtotime($measure->ts)*1000,(float)$measure->value);
}
$serie=array_reverse($serie);
$series[]=array('name'=>$device->descr,'data'=>$serie);
*/
}
//echo @json_encode($series);
?>