Add: moty_player - AccountType 0:player, 1:maestro

This commit is contained in:
2018-07-18 22:36:33 +09:00
parent 2f9c979a6f
commit a8fe0172d4
7 changed files with 28 additions and 7 deletions
@@ -25,7 +25,11 @@ exit;
function get_maestro_test_player_id($maestro_id) { function get_maestro_test_player_id($maestro_id) {
global $db_conn; global $db_conn;
$query = "SELECT MaestroTestID FROM moty_maestro WHERE MaestroID=?"; $query = "
SELECT MaestroTestID
FROM moty_maestro
WHERE MaestroID = ?
";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('i', $maestro_id); $stmt->bind_param('i', $maestro_id);
$stmt->execute(); $stmt->execute();
@@ -42,7 +46,11 @@ function get_maestro_test_player_id($maestro_id) {
function delete_maestro_test_player_record($player_id) { function delete_maestro_test_player_record($player_id) {
global $db_conn; global $db_conn;
$query = "DELETE FROM moty_best_record WHERE PlayerID=?;"; $query = "
DELETE
FROM moty_best_record
WHERE PlayerID = ?
";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('i', $player_id); $stmt->bind_param('i', $player_id);
$stmt->execute(); $stmt->execute();
@@ -26,7 +26,11 @@ exit;
function get_maestro_test_player_id($maestro_id) { function get_maestro_test_player_id($maestro_id) {
global $db_conn; global $db_conn;
$query = "SELECT MaestroTestID FROM moty_maestro WHERE MaestroID=?"; $query = "
SELECT MaestroTestID
FROM moty_maestro
WHERE MaestroID = ?
";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestro_id); $stmt->bind_param("i", $maestro_id);
$stmt->execute(); $stmt->execute();
@@ -22,7 +22,11 @@ exit;
function getPlayerCount($maestroID) { function getPlayerCount($maestroID) {
global $db_conn; global $db_conn;
$query = "SELECT COUNT(PlayerID) FROM moty_player WHERE MaestroID=?"; $query = "
SELECT COUNT(PlayerID)
FROM moty_player
WHERE MaestroID = ? AND AccountType <> 1
";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestroID); $stmt->bind_param("i", $maestroID);
$stmt->execute(); $stmt->execute();
@@ -26,7 +26,7 @@ function get_player_list_page($maestroID, $startNo, $endNo) {
$query = " $query = "
SELECT PlayerID, Name, EnterCode FROM moty_player SELECT PlayerID, Name, EnterCode FROM moty_player
WHERE MaestroID=? WHERE MaestroID = ? AND AccountType <> 1
ORDER BY PlayerID DESC ORDER BY PlayerID DESC
LIMIT ?, 10; LIMIT ?, 10;
"; ";
@@ -22,7 +22,11 @@ exit;
function getPlayerCount($maestroID, $playerName) { function getPlayerCount($maestroID, $playerName) {
global $db_conn; global $db_conn;
$query = "SELECT COUNT(PlayerID) FROM moty_player WHERE MaestroID = ? AND Name LIKE CONCAT('%', ?, '%')"; $query = "
SELECT COUNT(PlayerID)
FROM moty_player
WHERE MaestroID = ? AND AccountType <> 1 AND Name LIKE CONCAT('%', ?, '%')
";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param("is", $maestroID, $playerName); $stmt->bind_param("is", $maestroID, $playerName);
$stmt->execute(); $stmt->execute();
+1 -1
View File
@@ -27,7 +27,7 @@ function get_player_list_page($maestroID, $playerName, $startNo, $endNo) {
$query = " $query = "
SELECT PlayerID, Name, EnterCode FROM moty_player SELECT PlayerID, Name, EnterCode FROM moty_player
WHERE MaestroID = ? AND Name LIKE CONCAT('%', ?, '%') WHERE MaestroID = ? AND AccountType <> 1 AND Name LIKE CONCAT('%', ?, '%')
ORDER BY PlayerID DESC ORDER BY PlayerID DESC
LIMIT ?, 10; LIMIT ?, 10;
"; ";
+1
View File
@@ -15,6 +15,7 @@ CREATE TABLE moty_player (
MaestroID INT UNSIGNED NOT NULL, MaestroID INT UNSIGNED NOT NULL,
Name CHAR(50) NOT NULL, Name CHAR(50) NOT NULL,
EnterCode CHAR(6) NOT NULL, EnterCode CHAR(6) NOT NULL,
AccountType INT UNSIGNED NOT NULL,
FOREIGN KEY (MaestroID) REFERENCES moty_maestro(MaestroID) FOREIGN KEY (MaestroID) REFERENCES moty_maestro(MaestroID)
); );