How can I get records from db between a start date and a end date depending on the cirrent date?"!?! $currentdate = date('Y-m-d G:i:s'); $gasea="SELECT * FROM ".$prefix."_seasons WHERE start >= '$currentdate' AND end <= '$currentdate'"; $result = mysql_query($gasea); $gasearow = mysql_fetch_array($result); $gaseason = $gasearow['seasonid']; PHP: This doesnt get an output?!?1 Please help
What MySQL formats are start & end? Instead of using PHP to get the current date, try using NOW() instead: $gasea="SELECT * FROM ".$prefix."_seasons WHERE start >= NOW() AND end <= NOW()"; PHP: Peace,
That will only get records that are time stamped with the exact date and time of now to the exact second so its likely that you won't find any rows for this exact second. If you wanted all records today you will need to search from the start of the day eg '2009-06-15 00:00:00' and '2009-06-15 23:59:59'