Jay
Jay

Reputation: 443

Graphing Timestamps from MySQL in PHP

I am creating an analytics tracking script using PHP and MySQL.

Currently I am logging website visits to MySQL in a table using a "Timestamp" type field.

Is there a way to graph these timestamps to show traffic over a certain amount of time? Or, would I first need to create another table to hold the actual counts from the set day or hour or whatever period I am graphing?

I am just trying to do a simple line graph

http://manhattansound.com/images/graph.png

Upvotes: 0

Views: 1706

Answers (2)

ChrisW
ChrisW

Reputation: 5068

http://jpgraph.net/ seems to be fairly popular, and relatively easy to use. Google have also got a visualisation library. You should be able to create an array holding the information you want to display in a graph using a single SQL statement - what have you tried so far?

Upvotes: 1

Ronnie
Ronnie

Reputation: 11198

There are a ton of javascript libraries that will do graphing. Heck, you can even do graphs right in PHP. The data on the other hand...well that is up to you. You can select the time stamps from a start time and end time and that is your no. of visits in that period of time. I don't think a separate table would be needed if all you are looking for are the amount of hits (records) in a given period of time

Upvotes: 1

Related Questions