SChaput
Nov 3, 2009, 11:56 AM
I am trying to query my database for information that was entered along with the CURDATE() attribute, today, this week, this month.
if($type == "bestweek"){
$sql = "SELECT id, entrytext, positive, negative, verified, date, realtime FROM hmr WHERE verified > 2 AND DATE(realtime) = CURDATE()-7 ORDER BY positive DESC LIMIT $start, $limit";
$result = mysql_query($sql);
}
SHould the above code be giving me all results for the last week? When i run it it returns 0 results.
However, when i run this:
if($type == "besttoday"){
$sql = "SELECT id, entrytext, positive, negative, verified, date, realtime FROM hmr WHERE verified > 2 AND DATE(realtime) = CURDATE() ORDER BY positive DESC LIMIT $start, $limit"; $result = mysql_query($sql);
}
It gives me anything that was added today.
ANy help is appreciated.
if($type == "bestweek"){
$sql = "SELECT id, entrytext, positive, negative, verified, date, realtime FROM hmr WHERE verified > 2 AND DATE(realtime) = CURDATE()-7 ORDER BY positive DESC LIMIT $start, $limit";
$result = mysql_query($sql);
}
SHould the above code be giving me all results for the last week? When i run it it returns 0 results.
However, when i run this:
if($type == "besttoday"){
$sql = "SELECT id, entrytext, positive, negative, verified, date, realtime FROM hmr WHERE verified > 2 AND DATE(realtime) = CURDATE() ORDER BY positive DESC LIMIT $start, $limit"; $result = mysql_query($sql);
}
It gives me anything that was added today.
ANy help is appreciated.
