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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.