Welcome Guest, Not a member yet? Register   Sign In
How could i solve this problem the best way.
#1

[eluser]NyiPHP[/eluser]
Currently i have a db that stores ip and times visited an article.

Over time the website will contain 100+ articles.

And with around 100+ unike visiters (at least) every day.

lets say they all manage to go through each article at least one time.

thats 10k of ip's stored in my db.

- if a visitor visits article test, the ip will be stored with time/count/article_id
- if a visitor visit the article later, the count will raise by 1 and time updated.

i want to make top 10, most populare articles.

And now comes the hard part, how can i do this effectivly. With 100 users it can result max 10k data with all the articles viewed, but lets say i have 1000+ users and 1000+ articles. thats 1-million records (i assumed that each ip has gone through all 1000 articles).

How would the best, and most effectiv way be to perform the queries to match this up.
* Go through all the records -> Save them to an array -> Bulk together articles with same id, count up the counter_value for each ip.
or
* Query out all article_ids (from my article_table)
-> foreach article_id (from article_table)
-> Do a query with WHERE article_id="$article_id" (from my article_counter_table)
-> math up the values i have recived
or something else?

I'm new to php, so i would appreciate some good-pin-point-directed tips.
#2

[eluser]Otemu[/eluser]
One good option is to use Google Analytic APIto achieve this, check out some of these articles on it:

http://www.electrictoolbox.com/google-an...lar-pages/
http://www.dave-o-reed.co.uk/development...-interface
http://doogalbellend.blogspot.co.uk/2011...using.html





Theme © iAndrew 2016 - Forum software by © MyBB