I need to make a googlechart print 4 lines that will represent the evolution of temperature of 4 sensors that store their readings in MySQL db.
My schema is:
id | datetime | node_id | temperature
if I run the query:
SELECT * FROM sensor_readings ORDER BY id DESC LIMIT 4
the result is like:
4 | 21-5-2014 17:00 | 3 | 18.6
3 | 21-5-2014 17:01 | 1 | 18.5
2 | 21-5-2014 17:02 | 4 | 18.7
1 | 21-5-2014 17:04 | 2 | 18.2
For on node I could just query the results - WHERE node_id = 1 Now for four nodes how can I make my query in order to be able to echo a code like
[date, temperature (of node1), node1, temperature (of node2), node2 ....]
So that google chart is able to print my graph? I've made several attempts to load results in temporary arrays in php, without luck. Any idea how I could approach this issue? Thanks a lot!