1) { $statname = "$daysAgo days ago's Best Overall."; } break; case 3: $where = " YEARweek(solutions.dateModified) = YEARweek(CURRENT_DATE) "; $statname = "This week, starting Sunday"; break; case 4: $where = " ( month(solutions.dateModified) = month(CURRENT_DATE) AND year(solutions.dateModified) = year(CURRENT_DATE) ) "; $statname = "This month's Best"; break; } $sql = "SELECT users.displayName as Name, SUM(solutions.moves) as Moves, timediff(MAX(dateModified), maps.dateCreated) as Timetaken, users.wallColor, users.wallEmblem, users.displayColor, users.ID as userID, SUM(CASE WHEN solutions.dateModified < CURDATE() THEN solutions.championPointsWorth ELSE 0 END) AS championPointsWorth FROM `maps` JOIN `solutions` ON maps.ID = solutions.mapID JOIN `users` ON solutions.userID = users.ID WHERE $where GROUP BY solutions.userID ORDER BY Moves DESC, MAX(dateModified) ASC "; $result = mysql_query($sql); return displayStats($result, $statname); } ?>
12-28-12. I plan on making considerable changes to this page in the near future.
Thank you for your patience!


Showing scores for the maps played on
1) { echo "Current Day"; echo "Next Day"; } echo "Previous Day"; $time_start = microtime(true); $statContent .= displayPastMaze(1, 'Simple', $daysAgo); $statContent .= displayPastMaze(2, 'Normal', $daysAgo); $statContent .= displayPastMaze(3, 'Complex', $daysAgo); $statContent .= displayPastMaze(4, 'Special', $daysAgo); $time_end = microtime(true); $time = $time_end - $time_start; if ($_GET['debug'] == true) echo "StatContent Rechieve: $time seconds\n"; $special = 'Special'; if ($specialMapName != '') $special = $specialMapName; ?>
Simple Normal Complex Overall Week/Month
1) { $statname = "$daysAgo days ago's Best $name:"; } $stats = displayStats($result, $statname); //Sucky temporary solution: $GLOBALS['specialMapName'] = $map[0][6]; $sql = "SELECT `moves`, `displayName`, `solution` FROM `solutions` LEFT JOIN `users` ON solutions.userID = users.ID WHERE `mapID` = '$mapID' ORDER BY `moves` DESC, `dateModified` ASC LIMIT 1"; $result = mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($result) > 0) { list($bestMoves, $byName, $solution) = mysql_fetch_row($result); } $r = ''; $r .= '
'; $r .= "
"; $r .= '
'; $r .= $stats; $r .= '
'; $r .= '
'; $r .= "Best solution for this map: $bestMoves by $byName "; $r .= DisplayMap($map, $mapID, 'normal', 2); $r .= '
'; $r .= '
'; return $r; } function displaystats($result, $caption = NULL) { //Get names. $headers = ""; $headers .= "Rank"; $headers .= "Name"; $headers .= "Moves"; $headers .= "Time taken"; $headers .= ""; //Start table //$r .= ""; //$r .= ""; //Headers on the top. including Rank. //$r .= ""; //$r .= $headers; //$r .= ""; $i = 1; $championPoints = null; while ($row = mysql_fetch_assoc($result)) { $rowcontent = ''; $mapid = $row['mapID']; $solution = $row['solution']; $wallColor = $row['wallColor']; $wallEmblem = $row['wallEmblem']; $displayColor = $row['displayColor']; $displayName = $row['Name']; $userID = $row['userID']; //Default if ($wallColor == '') $wallColor = '#666666'; $x = "\n"; $x .= ""; $x .= ""; //$x .= "'; $x .= ''; $x .= ''; $x .= ""; if ($userID == $_SESSION['userID']) { $promotedContent .= $x; $championPoints = $row['championPointsWorth']; } else { $content .= $x; } $i++; } $r = ''; if($championPoints != null && $championPoints > 0) { $r .= "
Points earned: $championPoints
"; } $r .= "
$caption
$i$displayName" . $row['Name'] . '' . $row['Moves'] . '' . $row['Timetaken'] . '
"; $r .= ""; $r .= $headers; $r .= $promotedContent; $r .= $content; $r .= "
$caption
"; return $r; } function mysql_field_array( $query ) { $field = mysql_num_fields( $query ); for ( $i = 0; $i < $field; $i++ ) { $names[] = mysql_field_name( $query, $i ); } return $names; } ?>