Welcome Guest, Not a member yet? Register   Sign In
Views Counter: .TXT or Database?
#1

[eluser]HSKrustofsky[/eluser]
I was wondering what would be better to calculate/display the number of views something has gotten. Don't know whether I should go save the count in a file(.txt document), or if it would be better to save the data in a database?

Seems like it would be easier to save the data in a .txt file, but I'm kinda new at this so I would like to know what everyone else thinks.

Any suggestions?

I am also wondering if this would be a good idea to calculate the likes and dislikes of something?

Thanks in advanced.
#2

[eluser]Clooner[/eluser]
[quote author="HSKrustofsky" date="1279220595"] I would like to know what everyone else thinks.[/quote]
You are aware that there are billions of people Big Grin

Actually the one or other is not more difficult. It is just a different approach. Still I would say to go with db because it's more flexible.
#3

[eluser]WanWizard[/eluser]
In general, a database is a lot more efficient in I/O that you are. If you want to store it in a text file, you need logic to read, add, and write, and to deal with concurrency (you need a locking mechanism to prevent corruption in case of simultaneous requests).

Ideally, you wouldn't do this in your application, but use an external tool (p.e. based on webserver logs, Google analytics, etc) to compile reports of visitors.




Theme © iAndrew 2016 - Forum software by © MyBB