Ad

How To Use "setInterval" With "while Loop".?

I check all documants about setinterval from forum but.. I couldnt find what I want... Here is my question.:

my code is below:

<?php
include('database_connection.php');
$sorgu = $baglanti->query("select * from makale");
while ($sonuc = $sorgu->fetch_assoc())  {
 ?>

MY TABLE CODE HERE.. ( codes like : <?php echo $sonuc['proje_ismi'] ?> )

<?php }  ?>

I call datas to my table from mysql.. But I change database from admin panel..

And What I want is when I change some data from adminpanel... My users will see it immediatly in few sec with setInterval code without refreshing page...

How can I do that in my documants?

Ad

Answer

The simplest thing you can do is to refresh the page automatically after few seconds:

<script>
// Auto-refresh the page after 5 seconds:
setTimeout(function() {
  document.location.reload(true);
}, 5000);
</script>
Ad
source: stackoverflow.com
Ad