This topic is locked
[SOLVED]

  Count click before redirect

1/18/2011 9:24:16 PM
PHPRunner General questions
D
Dale author

I scoured the forum but found no answers to my need to be able to count the click of an ad and update the database.
I have field that I am using and setup as view as hyperlink. Works perfectly taking the user to a new page and displaying the link.

How can I catch that click and update my database to add 1 to my counter field total on the record.
There are some help using ajax and a bit of stir about jquery being able to do this.

Is there any way with the phprunner javascript api, or ajax functions, or the juery portion of PHPRunner that I can use.
Any suggestions?

Admin 1/19/2011

The general approach is to make link point to another, custom PHP page, passing link as a parameter i.e.

redirect.php?link=http://cnn.com


In redirect.php you write updated click count to the database and redirect user to that link.

D
Dale author 1/19/2011

Thankyou Sergey,

I was thinking that way too, I didnt want to go ahead with anything until I had confirmation there wasnt a better approach.

I will do exactly as suggested. I can there also redirect and open the users view page if there is no url supplied. Some of these guys with banner ads do not have a website to send them to, so this will solve all issues.