Jump to content

Recommended Posts

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

Edited by jawood
Link to comment
https://forums.phpfreaks.com/topic/294526-php-mysql-graph/
Share on other sites

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.