Fix: get ranking with date, time
This commit is contained in:
@@ -5,6 +5,8 @@ include "./../lib/send_error_code.php";
|
||||
|
||||
$user_id = $_POST["UserID"];
|
||||
$app_name = $_POST["AppName"];
|
||||
$date = $_POST["Date"];
|
||||
$time = $_POST["Time"];
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
@@ -19,6 +21,7 @@ $query = "
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
*/
|
||||
/*
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.Score) AS HighScore
|
||||
FROM moty_record D, moty_user U
|
||||
@@ -26,8 +29,16 @@ $query = "
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
*/
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.Score) AS HighScore
|
||||
FROM moty_record D, moty_user U
|
||||
WHERE D.userID = U.userID AND DATE(D.DateTime) = DATE(?) AND AppName = ?
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('s', $app_name);
|
||||
$stmt->bind_param('ss', $date, $app_name);
|
||||
$stmt->execute();
|
||||
|
||||
$stmt->bind_result($userID, $name, $high_score);
|
||||
|
||||
@@ -5,6 +5,8 @@ include "./../lib/send_error_code.php";
|
||||
|
||||
$user_id = $_POST["UserID"];
|
||||
$app_name = $_POST["AppName"];
|
||||
$date = $_POST["Date"];
|
||||
$time = $_POST["Time"];
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
@@ -19,15 +21,24 @@ $query = "
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
*/
|
||||
/*
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.Score) AS HighScore
|
||||
FROM moty_record D, moty_user U
|
||||
WHERE D.userID = U.userID AND DATE(D.DateTime) = DATE('2018-05-16') AND HOUR(D.DateTime) = HOUR('13:05:05') AND AppName = 'korean_word'
|
||||
WHERE D.userID = U.userID AND DATE(D.DateTime) = DATE('?') AND HOUR(D.DateTime) = HOUR('?') AND AppName = '?'
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
*/
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.Score) AS HighScore
|
||||
FROM moty_record D, moty_user U
|
||||
WHERE D.userID = U.userID AND DATE(D.DateTime) = DATE(?) AND HOUR(D.DateTime) = HOUR(?) AND AppName = ?
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('s', $app_name);
|
||||
$stmt->bind_param('sss', $date, $time, $app_name);
|
||||
$stmt->execute();
|
||||
|
||||
$stmt->bind_result($userID, $name, $high_score);
|
||||
|
||||
@@ -5,6 +5,8 @@ include "./../lib/send_error_code.php";
|
||||
|
||||
$user_id = $_POST["UserID"];
|
||||
$app_name = $_POST["AppName"];
|
||||
$date = $_POST["Date"];
|
||||
$time = $_POST["Time"];
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
@@ -19,6 +21,7 @@ $query = "
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
*/
|
||||
/*
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.Score) AS HighScore
|
||||
FROM moty_record D, moty_user U
|
||||
@@ -26,8 +29,16 @@ $query = "
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
*/
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.Score) AS HighScore
|
||||
FROM moty_record D, moty_user U
|
||||
WHERE D.userID = U.userID AND MONTH(D.DateTime) = MONTH(?) AND AppName = ?
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('s', $app_name);
|
||||
$stmt->bind_param('ss', $date, $app_name);
|
||||
$stmt->execute();
|
||||
|
||||
$stmt->bind_result($userID, $name, $high_score);
|
||||
|
||||
Reference in New Issue
Block a user