site statistics - number of clicks

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gaurav_sting
Forum Newbie
Posts: 19
Joined: Sat Mar 27, 2004 3:45 am
Location: Delhi

site statistics - number of clicks

Post by gaurav_sting »

hi,

i am stuck in a problem, kindly help.
i am making a site, in which the visitor clicks on apply (for a credit card), now, how can i know that how many times apply for a card has been clicked by the user, i need to create a statistics that for a particular card - n number of times apply was clicked.

Thank you,
Gaurav
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post by launchcode »

Do you mean the number of times that link was clicked? Or the number of times any one single user clicked the link??
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

- have the link "apply for card" go to "log.php"
- on log.php:
* open a text file with fopen
* get the number out of it
* add one to the number
* save the new number (replacing the old one)
* set a cookie to let your script know it's already been clicked by that person
* redirect to the original link
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

if you have MySQL db, that would be better than a txt file.
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

It's pointless. Why waste a whole db and table for ONE value?

Textfile is perfect for this.
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

notice i said 'if'

I, personally, find it more easy to use SQL commands than fwrite n fopen.

thats just me, either way it gets the job done.

:wink:
User avatar
doggy
Forum Commoner
Posts: 80
Joined: Tue Dec 09, 2003 5:01 am
Location: South Africa

Post by doggy »

I don`t compily anderstand what you wanne do but you could but you could but a insert sql on that page and every time it loads it counts a hit or if you want to make the hits per user how many times the user on his own did click you can set it in a session and then once the user did enter every thing and is done then count the finil session to a text file or a database. I hope this hopes and didn`t just waste pasteing space.
Post Reply