Mercurial > hg > ywww
view php/read/getLeaderboard.php @ 49:a67bf725e87b
put both paths in include_path and depend on that
author | Charlie Root |
---|---|
date | Wed, 16 Jan 2019 13:42:15 -0500 |
parents | b7376319d25a |
children |
line wrap: on
line source
<?PHP include "db.php"; $query = "CALL b_getLeaderboard()"; $results = my_query( $query,'gl'); $output = ""; $output .= "<?xml version=\"1.0\"?>"; $output .= "<Leaderboard>"; $leaderCount = 0; while($line = mysqli_fetch_assoc($results)) { if($leaderCount < 10) { $id = trim($line["UserID"]); if($id != 42) { $name = trim($line["DisplayName"]); $score = trim($line["Score"]); if($name == "") { $name = "User" . $id; } $output .= "<User>"; $output .= "<UserID>" . htmlspecialchars($id) . "</UserID>"; $output .= "<DisplayName>" . htmlspecialchars($name) . "</DisplayName>"; $output .= "<Score>" . htmlspecialchars($score) . "</Score>"; $output .= "</User>"; $leaderCount++; } } } $output .= "</Leaderboard>"; echo $output; mysqli_close($link); ?>