08.12.2015, 11:15
Hello,
Since I am not so experienced with PHP I faced a problem with ranking players on forums, I have this php code
But it just prints random players, can't really understand what is the problem, if you could help me solve this out I would be very grateful, thanks for reading
Output
Since I am not so experienced with PHP I faced a problem with ranking players on forums, I have this php code
Код:
<?php $query = $mysqlcon->prepare("SELECT playerName, playerMoney FROM `playerdata` ORDER BY playerMoney DESC LIMIT 0,10"); $query->execute(); if($query->rowCount() == 0) { echo "<tr><td colspan='6'><small>There are currently no registered players.</small></td></tr>"; } while($data = $query->fetch()) { echo '<tr><td> <a href="profile.php?user='.$data['playerName'].'">'.$data['playerName'].'</a> </td>'; echo "<td>".$data['playerMoney']."</td></tr>"; } ?>
Output