counting the click on a picture

B

Britney

hi,
I have user picture on aspx main page, if end-user click it 100 times,
then number_of_clicks will increment to 100.
however, What we do right now is that everytimes a user click on the
picture, application will executes an update statement

" update userhistory set number_of_clicks = number_of_clicks+1 where user_id
=@user_id"


I'm not sure if that's the best way to do this.
note that someone who isn't registered to website can still click on the
picture. I want to minimize the SQL Server traffic. I wonder if there is
way to get around it.

thanks
 
S

Siva M

One option to use the onClick client-side event of the image to increment a
JS variable. On postback just pass this JS variable value thru a hidden
input element. On the server-side, get hold of this hidden element and add
it's value to the db.

Of course, you will allow postback (thru a button may be?) only if the user
has logged on.

hi,
I have user picture on aspx main page, if end-user click it 100 times,
then number_of_clicks will increment to 100.
however, What we do right now is that everytimes a user click on the
picture, application will executes an update statement

" update userhistory set number_of_clicks = number_of_clicks+1 where user_id
=@user_id"


I'm not sure if that's the best way to do this.
note that someone who isn't registered to website can still click on the
picture. I want to minimize the SQL Server traffic. I wonder if there is
way to get around it.

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top