hey people.
i want to create a page views counter.
i know how to create 1 using php but what i want to create now is to create a very dynamic page views counter that update it's self when ever a new value is added to the database.

what i mean is when a use opens a page, the value which is saved in the database table will update and when it is updated the value on the page counter viewer will auto update the number of page views to the number of the database. i thought about reloading the page every 10 seconds to get some upto time values but that is not really interactive.

did you see the wordpress downloads counter??
i mean something close to that.
any help will be appreciated.

6 Years
Discussion Span
Last Post by makman99

What you want to look into is XMLhttprequest objects with javascript.

Basically have a php script in a separate file that gets the new page views and echos the new number, and the xmlhttprequest object will load that page, and store the output in object.responseText
Then just change the page view element on your page with the responseText of your xmlhttprequest

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.