Forum Moderators: coopster
rank_id ¦ date ¦ player_id ¦ rank
I list each player and rank with the date (8 in total for each week).
I can get current rankings (or archived rank if viewing old rankings) with no problem. The problem I have is when I try to view the previous rank. I can't get the previous week to the one I'm viewing to work.
this is the code I current have. I need to change the "Get previous power8 date" section so that it gives me the date prior to either the current date, or the date given in the url.
//Get current power8 date
if(!empty($_GET)){
$current_power8 = $_GET['date'];
} else {
$query_current = "SELECT date
FROM power8
GROUP BY date
ORDER BY date DESC
LIMIT 0,1";
$current = mysql_query($query_current, $connectDB) or die(mysql_error());
$row_current = mysql_fetch_assoc($current);
$current_power8 = $row_current['date'];
}//Get previous power8 date
$query_previous = "SELECT date
FROM power8
GROUP BY date
ORDER BY date DESC
WHERE date < $current_power8
LIMIT 0,1";
$previous = mysql_query($query_previous, $connectDB) or die(mysql_error());
$row_previous = mysql_fetch_assoc($previous);
$previous_power8 = $row_previous['date'];
I get an error with this: "WHERE date < $current_power8"
What can I do differently?