<?php $host="localhost"; $user="admin"; $password="passadmin"; $db="admin"; mysql_connect($host, $user, $password) or die("MySQL сервер недоступен!".mysql_error()); mysql_select_db($db) or die("Нет соединения с БД".mysql_error()); $db_query = mysql_query("SELECT * FROM userinfo ORDER BY rand() LIMIT 1"); $db_data = mysql_fetch_assoc($db_query); ?> <script> function getBanner() { // AJAX запрос } setInterval(getBanner, 10000); // Функция getBanner будет выполнятся каджые 30 сек </script> <?php echo $db_data['name']; ?> 

Help me to update the name line from the database every 10 seconds

  • In the sense of "write for me ajax request and server handler"? - zb '
  • one
    @ svoloch196, According to the rules of the forum, questions should not be confined to solving or completing assignments. Please clarify what you have done yourself and what did not work out. - Nicolas Chabanovsky
  • I tried to do it many times, I need this: that every 10 seconds he would get new lines from the database, let's say I have 100 records in the meringue and he should change them every 10 seconds and so on to infinity, it only works when I refresh the page - svoloch196
  • @ svoloch196 we understand what you need, it is not clear why you want us to write this for you. try to make, even a non-working example, and we will tell you what is wrong. Now it is wrong - you do not have a code that sends an ajax request and processes it on the server. - zb '
  • I tried to do this: function getBanner () {$ .ajax ({url: 'api.php', success: function () {alert ('Load was performed.');}}); } setInterval (getBanner, 1000); - svoloch196

0