allora ci siamo quasi.
ho cambiato il codice php
codice:
<?php$username = "root";
$password = "password";
$hostname = "localhost";
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
//select a database to work with
$selected = mysql_select_db("domotica",$dbhandle)
or die("Could not select examples");
//execute the SQL query and return records
$result = mysql_query("SELECT MAX(temperatura) AS maxTemp,TIMESTAMP(data_time) AS data_ris FROM sensore_esterno GROUP BY data_ris");
//SELECT temperatura,data_time FROM sensore_esterno ORDER BY temperatura + 0 DESC
//fetch tha data from the database
while ($row = mysql_fetch_array($result)) {
echo "data:".$row{'data_ris'}."temperatura:".$row{'maxTemp'}."<br>";
}
//close the connection
mysql_close($dbhandle);
?>
la parte dove va a prelevare i valori è questa
codice:
SELECT MAX(temperatura) AS maxTemp,TIMESTAMP(data_time) AS data_ris FROM sensore_esterno GROUP BY data_ris
solo che mi stampa questo
Connected to MySQL
data:2015-11-28 13:28:15 temperatura:9.312
data:2015-11-28 13:29:10 temperatura:33
data:2015-11-28 13:29:46 temperatura:12
il problema è che quel 9.312 dovrebbe essere alla fine perchè è una lettura più piccola del giorno.
Quindi presuno che sia un problema di decimali.
Avete suggerimenti