I am logging live data to a database where it is then selected by a php script and posted to a graph on a webpage.
A new datapoint is added every second and I have been graphing the most recent 300 points for a 5 minute history on the graph using the following:
SELECT * FROM table_name ORDER BY timestamp DESC LIMIT 300;
What I would like to do is add functionality to zoom out the data, losing resolution but showing a longer history but selecting every 5th row for example. However if I just select the most recent 300 5th entries the graph 'snakes' across the page as the values I am asking for are different each time as shown:
query 1 entries: [8:00] [7:55] [7:50] [7:45] [7:40] ...
query 2 entries: [8:01] [7:56] [7:51] [7:46] [7:41] ...
where what I want to do is
query 1 entries: [8:00] [7:55] [7:50] [7:45] [7:40] ...
query 1 entries: [8:05] [8:00] [7:55] [7:50] [7:45] ...
I have been looking for a way to do something like
SELECT * FROM table_name WHERE timestamp IS MULTIPLE OF 5 SECONDS
but have had no luck so here I am.