2016-04-15 51 views
0
$host= "localhost"; 
$user= "xxxx"; 
$pass= "xxxx"; 
$db="xxxx"; 

$connect= mysql_connect($host,$user,$pass); 
if (!$connect)die ("Cannot connect!"); 
mysql_select_db($db, $connect); 

$result = mysql_query("SELECT * FROM xxxx"); 
if($result){ 
    while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ 
    $url = $row['xxxx']; 
    echo $url; 
    } 
} 

上面的代码工作正常。等时间间隔后从数据库取数据

我想表明在5秒时间间隔

row1 //wait 5 sec 
row2 //wait 5 sec 
row3 //wait 5 sec 
row4 //wait 5 sec 

每个结果有什么办法,我可以做到这一点。

谢谢。

回答

2

您可以使用PHP睡眠功能延后执行

http://php.net/manual/en/function.sleep.php

但是你不应该这样做耽误你的页面在大多数情况下的输出。建议使用JavaScript客户端代码修改用户界面体验。

相关问题