Freid001 Posted December 20, 2010 Share Posted December 20, 2010 Ok so I have a PHP code below. How can I use Ajax to refresh this code every 5 seconds with out a page refresh? Any help would be great! Thanks -------------------------------------------------------------------------------------------- <?php $host= XXXX $mysql_user = XXXX $mysql_password = XXXX $mysql_database = XXXX ;$username = $test; $connection = XXXX $query = mysql_query("SELECT * FROM Game WHERE user='$username'"); $numrows = mysql_num_rows($query); while ($row = mysql_fetch_assoc($query)) { $Comment = $row['Comment']; } echo "$Comment"; ?> Link to comment https://forums.phpfreaks.com/topic/222213-ajax-refresh-code-every-5-seconds/ Share on other sites More sharing options...
Adam Posted December 22, 2010 Share Posted December 22, 2010 You can use the setInterval() method to periodically call your AJAX function. What have you tried so far? Link to comment https://forums.phpfreaks.com/topic/222213-ajax-refresh-code-every-5-seconds/#findComment-1150235 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.