show realtime total visitors
<p>I tried to show real time visitors visit(ed) the site. Below is my PHP file named <code>getTotalVisitors</code>. In the php file the <code>uniquevisitors</code> are showing well.</p>

<pre><code>include 'common.php'; //get database connection

$query = "SELECT SUM(uniquevisitors) as uniquevisitors  FROM " . $DBPrefix . "currentaccesses"; 

$params = array();
$db-&gt;query($query, $params);

while ($new = $db-&gt;fetch())
 {  
    $uniquevisitors = $new['uniquevisitors'];

 }
 echo "visitors until now: " .   $uniquevisitors . "&lt;br&gt;";
</code></pre>

<p>When i try to get it real time with the update and setInterval function with the below script, I cannot get it working. Anybody gives me the right direction/solution ?</p>

<pre><code> &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"&gt;&lt;/script&gt; 
  &lt;script type="text/javascript"&gt;
    $(document).ready(function()
    {
    function updategetTotalVisitors()
       {
         $('#datashow').load('getTotalVisitors.php');
       }
    updategetTotalVisitors(); //set the datacount as soon as the page is loaded
    setInterval( "updategetTotalVisitors()", 10000 ); //update the datashow every 10 seconds
    });
 &lt;/script&gt;
 &lt;p&gt;Visitors until now:&lt;/p&gt;
 &lt;div id = "datashow"&gt;&lt;/div&gt;
</code></pre>