Fix: DB user column -> player
This commit is contained in:
@@ -41,23 +41,22 @@ if($result === null) {
|
||||
function hasPlayerName($maestroID, $playerName, $enterCode) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "SELECT UserID FROM moty_user WHERE MaestroID=? AND Name=? AND EnterCode=?";
|
||||
$query = "SELECT PlayerID FROM moty_player WHERE MaestroID=? AND Name=? AND EnterCode=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('iss', $maestroID, $playerName, $enterCode);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($userID);
|
||||
$stmt->bind_result($playerID);
|
||||
// while($stmt->fetch())
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
|
||||
// $replyJSON["UserID"] = $userID;
|
||||
return $userID;
|
||||
return $playerID;
|
||||
}
|
||||
|
||||
function addPlayer($maestroID, $playerName, $enterCode) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "INSERT INTO moty_user (MaestroID, Name, EnterCode) VALUES (?, ?, ?)";
|
||||
$query = "INSERT INTO moty_player (MaestroID, Name, EnterCode) VALUES (?, ?, ?)";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('iss', $maestroID, $playerName, $enterCode);
|
||||
$stmt->execute();
|
||||
@@ -37,7 +37,7 @@ $db_conn->close();
|
||||
function deletePlayer($maestroID, $playerID) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "DELETE FROM moty_best_record WHERE MaestroID = ? AND UserID = ?";
|
||||
$query = "DELETE FROM moty_best_record WHERE MaestroID = ? AND PlayerID = ?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ii', $maestroID, $playerID);
|
||||
$result = $stmt->execute();
|
||||
@@ -47,7 +47,7 @@ function deletePlayer($maestroID, $playerID) {
|
||||
// echo "deleted row count : ".$stmt->affected_rows;
|
||||
// }
|
||||
|
||||
$query = "DELETE FROM moty_user WHERE MaestroID = ? AND UserID = ?";
|
||||
$query = "DELETE FROM moty_player WHERE MaestroID = ? AND PlayerID = ?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ii', $maestroID, $playerID);
|
||||
$result = $stmt->execute();
|
||||
@@ -61,16 +61,16 @@ function deletePlayer($maestroID, $playerID) {
|
||||
function hasPlayerID($maestroID, $playerID) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "SELECT UserID FROM moty_user WHERE MaestroID=? AND UserID=?";
|
||||
$query = "SELECT PlayerID FROM moty_player WHERE MaestroID=? AND PlayerID=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ii', $maestroID, $playerID);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($userID);
|
||||
$stmt->bind_result($playerID);
|
||||
// while($stmt->fetch())
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
|
||||
if($userID !== null)
|
||||
if($playerID !== null)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -79,16 +79,16 @@ function hasPlayerID($maestroID, $playerID) {
|
||||
function hasPlayerRecord($maestroID, $playerID) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "SELECT UserID FROM moty_best_record WHERE MaestroID=? AND UserID=?";
|
||||
$query = "SELECT PlayerID FROM moty_best_record WHERE MaestroID=? AND PlayerID=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ii', $maestroID, $playerID);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($userID);
|
||||
$stmt->bind_result($playerID);
|
||||
// while($stmt->fetch())
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
|
||||
if($userID !== null)
|
||||
if($playerID !== null)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -39,23 +39,22 @@ $db_conn->close();
|
||||
function hasSamePlayerData($maestroID, $playerID, $playerName, $enterCode) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "SELECT UserID FROM moty_user WHERE MaestroID=? AND UserID<>? AND Name=? AND EnterCode=?";
|
||||
$query = "SELECT PlayerID FROM moty_player WHERE MaestroID=? AND PlayerID<>? AND Name=? AND EnterCode=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('iiss', $maestroID, $playerID, $playerName, $enterCode);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($userID);
|
||||
$stmt->bind_result($playerID);
|
||||
// while($stmt->fetch())
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
|
||||
// $replyJSON["UserID"] = $userID;
|
||||
return $userID;
|
||||
return $playerID;
|
||||
}
|
||||
|
||||
function editPlayer($maestroID, $playerID, $playerName, $enterCode) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "UPDATE moty_user SET Name=?, EnterCode=? WHERE MaestroID=? AND UserID=?";
|
||||
$query = "UPDATE moty_player SET Name=?, EnterCode=? WHERE MaestroID=? AND PlayerID=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ssii', $playerName, $enterCode, $maestroID, $playerID);
|
||||
$stmt->execute();
|
||||
@@ -64,17 +63,16 @@ function editPlayer($maestroID, $playerID, $playerName, $enterCode) {
|
||||
function hasPlayerName($maestroID, $playerName, $enterCode) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "SELECT UserID FROM moty_user WHERE MaestroID=? AND Name=? AND EnterCode=?";
|
||||
$query = "SELECT PlayerID FROM moty_player WHERE MaestroID=? AND Name=? AND EnterCode=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('iss', $maestroID, $playerName, $enterCode);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($userID);
|
||||
$stmt->bind_result($playerID);
|
||||
// while($stmt->fetch())
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
|
||||
// $replyJSON["UserID"] = $userID;
|
||||
return $userID;
|
||||
return $playerID;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -24,7 +24,7 @@ if($maestroID === null) {
|
||||
}
|
||||
|
||||
$replyJSON = get_login_data($maestroID, $name, $enterCode);
|
||||
if($replyJSON["UserID"] === null) {
|
||||
if($replyJSON["PlayerID"] === null) {
|
||||
send_error_message($replyJSON, "입력한 이름/입장번호와 일치하는 계정이 없습니다");
|
||||
$db_conn->close();
|
||||
exit;
|
||||
@@ -54,17 +54,17 @@ function get_maestro_id($maestroName) {
|
||||
function get_login_data($maestroID, $name, $enterCode) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "SELECT UserID FROM moty_user WHERE MaestroID=? AND Name=? AND EnterCode=?";
|
||||
$query = "SELECT PlayerID FROM moty_player WHERE MaestroID=? AND Name=? AND EnterCode=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('iss', $maestroID, $name, $enterCode);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($user_id);
|
||||
$stmt->bind_result($player_id);
|
||||
// while($stmt->fetch())
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
|
||||
$replyJSON["MaestroID"] = $maestroID;
|
||||
$replyJSON["UserID"] = $user_id;
|
||||
$replyJSON["PlayerID"] = $player_id;
|
||||
|
||||
return $replyJSON;
|
||||
}
|
||||
+3
-3
@@ -30,15 +30,15 @@ $db_conn->close();
|
||||
function getPlayerCount($maestroID) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "SELECT COUNT(UserID) FROM moty_user WHERE MaestroID=?";
|
||||
$query = "SELECT COUNT(PlayerID) FROM moty_player WHERE MaestroID=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('i', $maestroID);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($userCount);
|
||||
$stmt->bind_result($playerCount);
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
|
||||
return $userCount;
|
||||
return $playerCount;
|
||||
}
|
||||
|
||||
?>
|
||||
+4
-4
@@ -24,20 +24,20 @@ function get_player_list_page($maestroID, $startNo, $endNo) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT UserID, Name, EnterCode FROM moty_user
|
||||
SELECT PlayerID, Name, EnterCode FROM moty_player
|
||||
WHERE MaestroID=?
|
||||
ORDER BY UserID DESC
|
||||
ORDER BY PlayerID DESC
|
||||
LIMIT ?, 10;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
// $stmt->bind_param('iii', $maestroID, $startNo, $endNo);
|
||||
$stmt->bind_param('ii', $maestroID, $startNo);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($userID, $name, $enterCode);
|
||||
$stmt->bind_result($playerID, $name, $enterCode);
|
||||
|
||||
$playerList = array();
|
||||
while($stmt->fetch()) {
|
||||
$player['UserID'] = $userID;
|
||||
$player['PlayerID'] = $playerID;
|
||||
$player['Name'] = $name;
|
||||
$player['EnterCode'] = $enterCode;
|
||||
array_push($playerList, $player);
|
||||
+3
-3
@@ -31,15 +31,15 @@ $db_conn->close();
|
||||
function getPlayerCount($maestroID, $playerName) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "SELECT COUNT(UserID) FROM moty_user WHERE MaestroID = ? AND Name = ?";
|
||||
$query = "SELECT COUNT(PlayerID) FROM moty_player WHERE MaestroID = ? AND Name = ?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('is', $maestroID, $playerName);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($userCount);
|
||||
$stmt->bind_result($playerCount);
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
|
||||
return $userCount;
|
||||
return $playerCount;
|
||||
}
|
||||
|
||||
?>
|
||||
+4
-4
@@ -25,20 +25,20 @@ function get_player_list_page($maestroID, $playerName, $startNo, $endNo) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT UserID, Name, EnterCode FROM moty_user
|
||||
SELECT PlayerID, Name, EnterCode FROM moty_player
|
||||
WHERE MaestroID=? AND Name=?
|
||||
ORDER BY UserID DESC
|
||||
ORDER BY PlayerID DESC
|
||||
LIMIT ?, 10;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
// $stmt->bind_param('iii', $maestroID, $startNo, $endNo);
|
||||
$stmt->bind_param('isi', $maestroID, $playerName, $startNo);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($userID, $name, $enterCode);
|
||||
$stmt->bind_result($playerID, $name, $enterCode);
|
||||
|
||||
$playerList = array();
|
||||
while($stmt->fetch()) {
|
||||
$player['UserID'] = $userID;
|
||||
$player['PlayerID'] = $playerID;
|
||||
$player['Name'] = $name;
|
||||
$player['EnterCode'] = $enterCode;
|
||||
array_push($playerList, $player);
|
||||
@@ -3,13 +3,13 @@ header('Content-Type: application/json');
|
||||
|
||||
$maestro_id = $_POST["MaestroID"];
|
||||
$app_id = $_POST["AppID"];
|
||||
$user_id = $_POST["UserID"];
|
||||
$player_id = $_POST["PlayerID"];
|
||||
$date = $_POST["Date"];
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
|
||||
$replyJSON = get_history_record($maestro_id, $app_id, $user_id, $date);
|
||||
$replyJSON = get_history_record($maestro_id, $app_id, $player_id, $date);
|
||||
if($replyJSON.length === 0) {
|
||||
send_error_message($replyJSON, "히스토리 기록 없음");
|
||||
$db_conn->close();
|
||||
@@ -20,20 +20,20 @@ echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
|
||||
|
||||
function get_history_record($maestro_id, $app_id, $user_id, $date) {
|
||||
function get_history_record($maestro_id, $app_id, $player_id, $date) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT DATE(BR.RecordDateTime) AS Date, MAX(BR.BestRecord) AS HighScore, AA.AppName AS AppName
|
||||
FROM moty_best_record BR
|
||||
INNER JOIN moty_app AS AA
|
||||
ON BR.MaestroID = ? AND BR.UserID = ? AND DATE(BR.RecordDateTime) <= ? AND BR.AppID = ? AND BR.AppID = AA.AppID
|
||||
ON BR.MaestroID = ? AND BR.PlayerID = ? AND DATE(BR.RecordDateTime) <= ? AND BR.AppID = ? AND BR.AppID = AA.AppID
|
||||
GROUP BY DATE(BR.RecordDateTime)
|
||||
ORDER BY BR.RecordDateTime DESC
|
||||
LIMIT 7
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('iisi', $maestro_id, $user_id, $date, $app_id);
|
||||
$stmt->bind_param('iisi', $maestro_id, $player_id, $date, $app_id);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($date, $score, $app_name);
|
||||
|
||||
|
||||
@@ -24,20 +24,20 @@ function get_ranking_record_day($maestro_id, $date, $app_id) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT BR.userID As UserID, U.Name AS Name, MAX(BR.BestRecord) AS HighScore
|
||||
FROM moty_best_record BR, moty_user U
|
||||
WHERE BR.MaestroID = ? AND BR.userID = U.userID AND DATE(BR.RecordDateTime) = ? AND AppID = ?
|
||||
GROUP BY BR.userID
|
||||
SELECT BR.playerID As PlayerID, U.Name AS Name, MAX(BR.BestRecord) AS HighScore
|
||||
FROM moty_best_record BR, moty_player U
|
||||
WHERE BR.MaestroID = ? AND BR.playerID = U.playerID AND DATE(BR.RecordDateTime) = ? AND AppID = ?
|
||||
GROUP BY BR.playerID
|
||||
ORDER BY max(BR.BestRecord) DESC;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('isi', $maestro_id, $date, $app_id);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($userID, $name, $high_score);
|
||||
$stmt->bind_result($playerID, $name, $high_score);
|
||||
|
||||
$ranking_record_array = array();
|
||||
while($stmt->fetch()) {
|
||||
$ranking_record['UserID'] = $userID;
|
||||
$ranking_record['PlayerID'] = $playerID;
|
||||
$ranking_record['Name'] = $name;
|
||||
$ranking_record['HighScore'] = $high_score;
|
||||
array_push($ranking_record_array, $ranking_record);
|
||||
|
||||
@@ -23,20 +23,20 @@ function get_ranking_record_hour($maestro_id, $date, $time, $app_id) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT BR.userID As UserID, U.Name AS Name, MAX(BR.BestRecord) AS HighScore
|
||||
FROM moty_best_record BR, moty_user U
|
||||
WHERE BR.MaestroID = ? AND BR.userID = U.userID AND DATE(BR.RecordDateTime) = ? AND HOUR(BR.RecordDateTime) = HOUR(?) AND AppID = ?
|
||||
GROUP BY BR.userID
|
||||
SELECT BR.playerID As PlayerID, U.Name AS Name, MAX(BR.BestRecord) AS HighScore
|
||||
FROM moty_best_record BR, moty_player U
|
||||
WHERE BR.MaestroID = ? AND BR.playerID = U.playerID AND DATE(BR.RecordDateTime) = ? AND HOUR(BR.RecordDateTime) = HOUR(?) AND AppID = ?
|
||||
GROUP BY BR.playerID
|
||||
ORDER BY max(BR.BestRecord) DESC;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('issi', $maestro_id, $date, $time, $app_id);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($userID, $name, $high_score);
|
||||
$stmt->bind_result($playerID, $name, $high_score);
|
||||
|
||||
$ranking_record_array = array();
|
||||
while($stmt->fetch()) {
|
||||
$ranking_record['UserID'] = $userID;
|
||||
$ranking_record['PlayerID'] = $playerID;
|
||||
$ranking_record['Name'] = $name;
|
||||
$ranking_record['HighScore'] = $high_score;
|
||||
array_push($ranking_record_array, $ranking_record);
|
||||
|
||||
@@ -24,20 +24,20 @@ function get_ranking_record_month($maestro_id, $date, $time, $app_id) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT BR.userID As UserID, U.Name AS Name, MAX(BR.BestRecord) AS HighScore
|
||||
FROM moty_best_record BR, moty_user U
|
||||
WHERE BR.MaestroID = ? AND BR.userID = U.userID AND MONTH(BR.RecordDateTime) = MONTH(?) AND AppID = ?
|
||||
GROUP BY BR.userID
|
||||
SELECT BR.playerID As PlayerID, U.Name AS Name, MAX(BR.BestRecord) AS HighScore
|
||||
FROM moty_best_record BR, moty_player U
|
||||
WHERE BR.MaestroID = ? AND BR.playerID = U.playerID AND MONTH(BR.RecordDateTime) = MONTH(?) AND AppID = ?
|
||||
GROUP BY BR.playerID
|
||||
ORDER BY max(BR.BestRecord) DESC;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('isi', $maestro_id, $date, $app_id);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($userID, $name, $high_score);
|
||||
$stmt->bind_result($playerID, $name, $high_score);
|
||||
|
||||
$ranking_record_array = array();
|
||||
while($stmt->fetch()) {
|
||||
$ranking_record['UserID'] = $userID;
|
||||
$ranking_record['PlayerID'] = $playerID;
|
||||
$ranking_record['Name'] = $name;
|
||||
$ranking_record['HighScore'] = $high_score;
|
||||
array_push($ranking_record_array, $ranking_record);
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$maestro_id = $_POST["MaestroID"];
|
||||
$user_id = $_POST["UserID"];
|
||||
$player_id = $_POST["PlayerID"];
|
||||
$app_id = $_POST["AppID"];
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
|
||||
$replyJSON = array();
|
||||
$replyJSON["BestRecord"] = get_best_record($maestro_id, $app_id, $user_id);
|
||||
$replyJSON["BestRecord"] = get_best_record($maestro_id, $app_id, $player_id);
|
||||
if($replyJSON.length === 0) {
|
||||
send_error_message($replyJSON, "히스토리 기록 없음");
|
||||
$db_conn->close();
|
||||
@@ -20,16 +20,16 @@ echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
|
||||
|
||||
function get_best_record($maestro_id, $app_id, $user_id) {
|
||||
function get_best_record($maestro_id, $app_id, $player_id) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT BestRecord
|
||||
FROM moty_best_record
|
||||
WHERE MaestroID = ? AND AppID = ? AND UserID = ? AND DATE(RecordDateTime) = DATE(NOW())
|
||||
WHERE MaestroID = ? AND AppID = ? AND PlayerID = ? AND DATE(RecordDateTime) = DATE(NOW())
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("iii", $maestro_id, $app_id, $user_id);
|
||||
$stmt->bind_param("iii", $maestro_id, $app_id, $player_id);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($best_record);
|
||||
$stmt->fetch();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$maestro_id = $_POST["MaestroID"];
|
||||
$user_id = $_POST["UserID"];
|
||||
$player_id = $_POST["PlayerID"];
|
||||
$app_id = $_POST["AppID"];
|
||||
$best_record = $_POST["BestRecord"];
|
||||
// echo $best_record." / ";
|
||||
@@ -12,12 +12,12 @@ include "./../setup/connect_db.php";
|
||||
$prev_best_record_id = -1;
|
||||
$prev_best_record = 0;
|
||||
|
||||
$prev_best_record_id = get_best_record($maestro_id, $app_id, $user_id);
|
||||
$prev_best_record_id = get_best_record($maestro_id, $app_id, $player_id);
|
||||
// echo "id : ".$prev_best_record_id." ".$prev_best_record;
|
||||
|
||||
if($prev_best_record_id < 0) {
|
||||
if($prev_best_record_id === null || $prev_best_record_id < 0) {
|
||||
// echo "insert";
|
||||
insert_best_record($maestro_id, $app_id, $user_id, $best_record);
|
||||
insert_best_record($maestro_id, $app_id, $player_id, $best_record);
|
||||
} else {
|
||||
// echo $best_record." ".$prev_best_record;
|
||||
if($best_record > $prev_best_record) {
|
||||
@@ -29,17 +29,17 @@ if($prev_best_record_id < 0) {
|
||||
$db_conn->close();
|
||||
|
||||
|
||||
function get_best_record($maestro_id, $app_id, $user_id) {
|
||||
function get_best_record($maestro_id, $app_id, $player_id) {
|
||||
global $db_conn;
|
||||
global $prev_best_record_id, $prev_best_record;
|
||||
|
||||
$query = "
|
||||
SELECT BestRecordID, BestRecord
|
||||
FROM moty_best_record
|
||||
WHERE MaestroID = ? AND AppID = ? AND UserID = ? AND DATE(RecordDateTime) = DATE(NOW()) AND HOUR(RecordDateTime) = HOUR(NOW())
|
||||
WHERE MaestroID = ? AND AppID = ? AND PlayerID = ? AND DATE(RecordDateTime) = DATE(NOW()) AND HOUR(RecordDateTime) = HOUR(NOW())
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("iii", $maestro_id, $app_id, $user_id);
|
||||
$stmt->bind_param("iii", $maestro_id, $app_id, $player_id);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($prev_best_record_id, $prev_best_record);
|
||||
$stmt->fetch();
|
||||
@@ -52,15 +52,15 @@ function get_best_record($maestro_id, $app_id, $user_id) {
|
||||
}
|
||||
|
||||
|
||||
function insert_best_record($maestro_id, $app_id, $user_id, $best_record) {
|
||||
function insert_best_record($maestro_id, $app_id, $player_id, $best_record) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
INSERT INTO moty_best_record (MaestroID, UserID, AppID, BestRecord, RecordDateTime)
|
||||
INSERT INTO moty_best_record (MaestroID, PlayerID, AppID, BestRecord, RecordDateTime)
|
||||
VALUES (?, ?, ?, ?, NOW());
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('iiid', $maestro_id, $user_id, $app_id, $best_record);
|
||||
$stmt->bind_param('iiid', $maestro_id, $player_id, $app_id, $best_record);
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user