I have a page that shows data from my database. Before the user sees the data they have a few select boxes so they can choose to filter the data in a number of different ways eg to chose to show data over a certain period of time. and the url looks similar to the below as I am using the get method.
http://www.example/com?report=2&days=7&etc=2
This all works fine and the users can filter the data to get the different results that they want. I have been viewing my analytics account and can see that some queries are more popular than others. How can I let the users know which queries are the most popular (eg most viewed over the last 24 hours). Currently I have made a manual html table that I update in the morning based on the Analytics data.
eg
<table>
<tbody>
<tr><th>query</th><th>link</th></tr>
<tr><td>Show data from last 7 days</td><td><a href="http://www.example/com?report=2&days=7&etc=2">View</a></td></tr>
</tbody>
</table>
I thought about adding a table called count which has id, query, timestamp and saying
$a='report=';
$b=$_SERVER['QUERY_STRING'];
if($b == $a . $report['id'])
{}
else
{//Insert id, query, timestamp into the database}
This way I can do a count for a certain time period on queries that have the additional sorting paremeters. Is this the best way to acheive this?
Create a table that stores the query-part of the url and the timestamp. It needs no other fields as you’ll get a running sum of the latest calls.
Then get something like
to get the most requested urls for the last 24 hours.