[eluser]iainco[/eluser]
Hey guys, got a project going where users can read and comment on different news articles.
However, I'm a little bit stuck on how best to count the number of times a user has read an article.
For example, the simplest way to record the number of reads is by using a "read_count" field in my "article" table and then incrementing this field every time a user clicks on the link for an article (I would call the increment function just before I load the view).
But it's quite obvious with the above method that I won't get a true representation of the number of reads. Users who refresh their page would induce another increment on the read count.
So I think the best way is doing it so that any reads registered in a 10 minute period count as only 1 read.
I'm thinking I'll need to use the session class and use the session ID's and tie in with the session refresh time.
So finally, I would then need another table in my database called "article_read", which will store information which will be refreshed every 10 minutes, and then every 10 minutes I would use that information to update the read_count field in the article table.
Hmmm, rambling a bit now! Does anyone have experience with this sort of thing?
Thanks