Jump to content

Constantly Updating Counter


.Darkman

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.