I want so when I load the page, it will start getting 5 rows(mysql query) every second from the mysql(with a cool fade-in effect if possible).
I'm using this code to show a list of all married players and their partners, and my database has many partners and I'm using an API to convert their UUID to their username, which takes long to load & convert, so I need to turn it into async.
I'm still learning PHP btw!
And finally, here's the code:
$mysql = mysql_connect('localhost', 'root', '');
mysql_select_db("marry",$mysql);
$result = mysql_query("SELECT player1,player2 FROM marriage_marriages");
$rows = mysql_num_rows($result);
if ($rows) {
echo '<div class="col-lg-12"><table class="table"> <h2>Married Players</h2><thead><tr><th>User 1</th><th>User 2</th></tr></thead><tbody>';
while ($row = mysql_fetch_assoc($result)) {
echo '<tr>';
echo '<td>'. file_get_contents("http://api.mcusername.net/uuidtoplayer/".str_replace('-', '', '' . $row["player1"] . '')) .'</td>'; #user1
echo '<td>'. file_get_contents("http://api.mcusername.net/uuidtoplayer/".str_replace('-', '', '' . $row["player2"] . '')) .'</td>'; #user1
echo '</tr>';
}
echo '</tbody></table></div>';