I'm starting with MySQL
and Highcharts
, to show graphs of some sensors.
The first thing I do is a query to save the data in a array
. I do it like this:
<?php
$con = mysql_connect("localhost", "", "");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $con);
$result = mysql_query("SELECT * FROM table");
while($row = mysql_fetch_array($result))
{
echo $row['Time'] . "\t" . $row['Probe1']. "\n";
}
mysql_close($con);
?>
The fact is that I need the data in the Probe1
column to be divided by 10 (because the program sends them to me without decimals). I have tried several ways, but I do not get it (like doing a query of your own within $row
). I think I've complicated my life and I'm sure it's something much simpler. Can you lend me a hand?