我希望显示div中注册用户的总数。但希望它显示实时/实时计数。
我(目前)正在使用:
<?php
$sql="SELECT * FROM QWERTY WHERE abc = '123' AND xyz = '789' ORDER BY id";
if ($result=mysqli_query($conn,$sql)) {
$rowcount=mysqli_num_rows($result);
printf("%d",$rowcount);
mysqli_free_result($result);
} ?>
plz帮助我显示实时/实时计数
答案 0 :(得分:0)
您可以使用一些jquery魔法从远程页面获取当前计数,然后将其放入DIV。
http://paste.liam.systems/view/QZVG63LUZ9
上面的脚本将每隔5秒从一个URL拉出并将其添加到div中。
答案 1 :(得分:0)
this is not what i was looking for but it worked ::
1.php
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
setInterval(function(){
$("#count").load('2.php')
}, 2000);
});
</script>
</head>
<body>
<div id="count"></div>
</body>
</html>
2.php
<?php
$sql="SELECT * FROM QWERTY WHERE abc = '123' AND xyz = '789' ORDER BY id";
if ($result=mysqli_query($conn,$sql)) {
$rowcount=mysqli_num_rows($result);
printf("%d",$rowcount);
mysqli_free_result($result);
} ?>