.Darkman Posted February 27, 2008 Share Posted February 27, 2008 Hello, The counter on the homepage of http://www.deviantart.com/ looks great. The one which reads "XX Deviations". It constantly updates. I suppose, it uses AJAX. Can any help me create one like this ? (i.e) I'd like to fetch the COUNT() of something from the database and display it... Thanks, Link to comment https://forums.phpfreaks.com/topic/93354-constantly-updating-counter/ Share on other sites More sharing options...
cooldude832 Posted February 27, 2008 Share Posted February 27, 2008 yes its just a simple query you can use a second page to do this that just outputs deviations: COUNTS and just have it do <?php $q = " Select count(*) from `table`"; $r = mysql_query($q) or die(mysql_error()); echo "Deviations: ".mysql_result($r,0); ?> and then in the javascript just update the inner html of that div every X seconds Link to comment https://forums.phpfreaks.com/topic/93354-constantly-updating-counter/#findComment-478167 Share on other sites More sharing options...
.Darkman Posted February 27, 2008 Author Share Posted February 27, 2008 and then in the javascript just update the inner html of that div every X seconds How is that done ? I put the above code in a separate file... ? Then, whats next ? Thanks Link to comment https://forums.phpfreaks.com/topic/93354-constantly-updating-counter/#findComment-478173 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.