How can refresh MySQL query in every second using ajax or php? -
i'm new in ajax. have try find solution failed. want refresh mysql query in every second how? have no idea how please me.
code
$sql="select * `user`"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { echo $row['fname']; echo $row['email']; }
try below
<div class="result"></div> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> <script> function refresh_div() { jquery.ajax({ url:'your php page url', type:'post', success:function(results) { jquery(".result").html(results); } }); } t = setinterval(refresh_div,1000); </script>
Comments
Post a Comment