From d7b0c04459a6ec42a37255c38d67cea14fb60e61 Mon Sep 17 00:00:00 2001 From: BlueRaja Date: Sat, 26 Jan 2013 03:30:45 -0600 Subject: Moved usersData table to users table, added a few more columns to users (currently unused) --- pages/achievements.php | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'pages/achievements.php') diff --git a/pages/achievements.php b/pages/achievements.php index e3f9e8d..f2c5aba 100644 --- a/pages/achievements.php +++ b/pages/achievements.php @@ -225,16 +225,6 @@ if ($result) { //Validate selection and then update. if (isset($_POST['doupdate']) AND !$viewer) { - // Ensure the user is located in userData. - $sql = "SELECT * FROM `userData` - WHERE `userID` = '$userID'"; - $result = mysql_query($sql); - if (mysql_num_rows($result) == 0) { - $sql = "INSERT INTO `userData` (`userID`, `displayColor`, `wallColor`) - VALUES ('$userID', '#cccccc', '#666666')"; - mysql_query($sql); - } - //print_R($unlocks); $unlockIDC = $_POST['selectColorID']; $unlockColor = $unlocks[1][$unlockIDC]['value']; @@ -253,9 +243,9 @@ if (isset($_POST['doupdate']) AND !$viewer) { $unlockNameColor = '#cccccc'; if ($unlockColor == $_POST['selectColor']) { - $sql = "UPDATE `userData` + $sql = "UPDATE `users` SET `wallColor` = '$unlockColor' - WHERE `userID` = '$userID'"; + WHERE `ID` = '$userID'"; $result = mysql_query($sql); if (!$result) { echo "Error updating wall color"; @@ -267,9 +257,9 @@ if (isset($_POST['doupdate']) AND !$viewer) { } } if ($unlockEmblem == $_POST['selectEmblem']) { - $sql = "UPDATE `userData` + $sql = "UPDATE `users` SET `wallEmblem` = '$unlockEmblem' - WHERE `userID` = '$userID'"; + WHERE `ID` = '$userID'"; $result = mysql_query($sql); if (!$result) { echo "Error updating wall color"; @@ -282,9 +272,9 @@ if (isset($_POST['doupdate']) AND !$viewer) { } if ($unlockNameColor == $_POST['selectNameColor']) { - $sql = "UPDATE `userData` + $sql = "UPDATE `users` SET `displayColor` = '$unlockNameColor' - WHERE `userID` = '$userID'"; + WHERE `ID` = '$userID'"; $result = mysql_query($sql); if (!$result) { echo "Error updating wall color"; @@ -330,14 +320,12 @@ SELECT users.isAdmin, users.totalMoves, users.totalMazes AS totalSolutions, - IfNull(userData.wallColor, '#666666'), - IfNull(userData.displayColor, '#cccccc'), - userData.wallEmblem + users.wallColor, + users.displayColor, + users.wallEmblem FROM `users` LEFT JOIN `solutions` ON users.ID = solutions.userID -LEFT JOIN `userData` - ON users.ID = userData.userID WHERE users.ID = '$userID' GROUP BY solutions.userID "; -- cgit v1.2.3