Page 1 of 1

General Considerations for Click Counter

Posted: Tue Apr 19, 2005 9:23 pm
by Death
Hi guys,

I want to count the hits I'm sending to various links. It's pretty easy to do but I'm still not sure about something. I'm presumming it would be faster to store the counts in a database rather than a flat file, does that mean I have to make the connection, access the data, increment it, then close the connection every single time someone clicks a link I am counting ?

I am a pro at C(++) so programming comes easy to me but I'm a little rusty on database stuff.

It just seems like a lot of overhead to maintain and increment some integers.

So am I on the right track here ?

Any guidence would be appreciated.

Thanks.

Posted: Wed Apr 20, 2005 12:00 am
by feyd
that's the typical way.. Connecting to a database is rather simple for most protocols. For instance, the average phpbb page makes one database connection and 10 or more queries before completing the page.

Unless you are doing very large hit counts, don't worry about it too much. You can use connection pooling and/or persistant connections to offset the connection time if you feel it's too high...