jawood Posted February 11, 2015 Share Posted February 11, 2015 Hi hoping someone can help with an issue im having displaying data from a MySQL database with php. Attached is a copy of the code its the first graph at the top that I cant get to display the data. It wont display the minutes along the bottom or draw the graph lines. The page is located at www.inshome.net.au/dashboard.php I have a feeling its to do with the getting the time from the table! MYSQL table id event timestamp current_timestamp dht22temp varchar(10) humidity varchar(10) bmp180temp varchar(10) pressure varchar(10) altitude varchar(10) current0 varchar(10) current1 varchar(10) code.php Link to comment https://forums.phpfreaks.com/topic/294526-php-mysql-graph/ Share on other sites More sharing options...
Barand Posted February 11, 2015 Share Posted February 11, 2015 A MySql type TIMESTAMP is not a unix-style timestamp but yyyy-mm-dd hh-ii-ss format. Try SELECT TIMESTAMPDIFF(MINUTE, event, NOW()) as time1 , dht22temp , humidity , pressure FROM sensordata WHERE event > NOW()-INTERVAL 2 HOUR ORDER BY Time Link to comment https://forums.phpfreaks.com/topic/294526-php-mysql-graph/#findComment-1505421 Share on other sites More sharing options...
jawood Posted February 11, 2015 Author Share Posted February 11, 2015 thanks I made the suggested change and still not getting any data displayed. should it be ORDER BY time1 ? Link to comment https://forums.phpfreaks.com/topic/294526-php-mysql-graph/#findComment-1505422 Share on other sites More sharing options...
jawood Posted February 11, 2015 Author Share Posted February 11, 2015 That did it changing that last time to time1 thanks very much. Thou can I ask just one other question How to do change the increments on the vertical axis from 300 600 900 to say from -10 to 1100 in steps of say 20 Link to comment https://forums.phpfreaks.com/topic/294526-php-mysql-graph/#findComment-1505423 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.