View Full Version : site statistics - number of clicks

05-21-2004, 04:52 AM

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,

05-21-2004, 10:33 AM
You'll need to have a login system in place, so that you can identify the user. (after login, store the users ID inside a sessionvariable)
And then you need to increment a variable inside the table with your userdata. Like
$sql="update usertabel set cardcounter=cardcounter+1 where userID = " . $_SESSION['uID'] ;

But i woul create a seperate table where you insert a new record with the userID, the PHP sessionID, the date-time and all other relevant data. You can then get the count for each user by running a

SELECT count(*) as cardcounter, userID FROM cardtransactions GROUP BY userID

It gives you more detail and doesn't realy create any overhead since this query can be ran ofline or when trafic is low.