0

I have a file with structure like this:

    <?php
$query = mysql_query("SELECT id_history FROM tb_history");
$data = mysql_fetch_array($query);

$VariableA = count($data);
$variableB = $VariableA + 1;

if($VariableA == $VariableB)
{
<script>clearInterval();</script>
}
else
{
<script>setInterval()</script>
}

?>

I'm trying to make a page refresh automatically within few second and stop refreshing when a new data added to table tb_history. can you suggest me better algorithm??

Thank You...

user3581186
  • 37
  • 1
  • 7
  • dont you think you should echo those `` ? and instead doing this just update by ajax no useless reloading and less load on server. BTW check this [Why shouldn't I use mysql_* functions in PHP?](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php/14110189#14110189) – NullPoiиteя May 18 '14 at 08:37
  • and why are you doing this refresh ? prefer ajax – jahanvi Kashyap May 18 '14 at 08:37

0 Answers0