简体   繁体   English

如何在“while 循环”中使用“setInterval”。?

[英]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.:我从论坛中检查了所有关于 setinterval 的文档,但是......我找不到我想要的......这是我的问题。:

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 echo $sonuc['proje_ismi']?>

<?php }  ?>

I call datas to my table from mysql.. But I change database from admin panel..我从 mysql 将数据调用到我的表中。但是我从管理面板更改了数据库。

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...我想要的是当我从管理面板更改一些数据时......我的用户将在几秒钟内使用setInterval代码立即看到它,而无需刷新页面......

How can I do that in my documants?我怎样才能在我的文档中做到这一点?

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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM