Hi,guys,I need some advice on building image link counter and image display counter.

1.I need to know how to track each time the image display counter(should be something like this $counter .= $counter + 1), the image display counter only increase for unique visitor.Is that log the counter into text file better or store in the database better(this counter will keep updating the database or the counter log file)?

2.I need to know how to track whether the link of the image is click or not by the visitor,if click by visitor then only i update the counter click for the related image,
can anyone show me some code to do this kind of click counter when the visitor click the image link?

Kindly give any sample code / reference for the 2 situation above.Thanks in advance.


I would store your information in a database - much easier to work with if you want to use the number of clicks for anything in particular.

With regard to clicking on the image you would need to use either javascript with an onclick() event to count or send the user (without them knowing) to another page when they click the image and use this page to update the count and then database then forward to the actually image / image page.