Fix: maestro main page player count bug

This commit is contained in:
2018-09-04 17:58:42 +09:00
parent ae16c020ee
commit f81868e3a5
3 changed files with 34 additions and 12 deletions
+20 -1
View File
@@ -13,11 +13,12 @@ if($info === null) {
send_result_fail();
exit;
}
$playerCount = getPlayerCount($maestroID);
set_data("name", $info["name"]);
set_data("email", $info["email"]);
set_data("accountType", $info["accountType"]);
set_data("playerCount", $info["playerCount"]);
set_data("playerCount", $playerCount);
send_result_success();
exit;
@@ -46,4 +47,22 @@ function get_maestro_info($maestroID) {
return $info;
}
function getPlayerCount($maestroID) {
global $db_conn;
$query = "
SELECT COUNT(PlayerID)
FROM player
WHERE MaestroID = ? AND AccountType <> 1
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestroID);
$stmt->execute();
$stmt->bind_result($playerCount);
$stmt->fetch();
$stmt->close();
return $playerCount;
}
?>