Filtering a recordset based on 'todays' date - how to compare a start date and end date?
What is wrong with this...
<?php
@session_start();
if("" == "") {
$_SESSION["todaySESH"] = " ". date('d M Y h:m:s')." ";
}
?>
<?php
$rsLIVECOMP = new WA_MySQLi_RS("rsLIVECOMP",$csdbmysqli,1);
$rsLIVECOMP->setQuery("SELECT dreamcarCOMPID, dreamcarCOMPDATESTART, dreamcarCOMPDATEND, dreamcarCOMPTITLE, dreamcarCOMPSUMMARY, dreamcarCOMPTEXT, dreamcarCOMPIMG, dreamcarCOMPDELETE FROM dreamcarCOMPS WHERE dreamcarCOMPDATESTART <= ? AND dreamcarCOMPDATEND >= ?");
$rsLIVECOMP->bindParam("t", "".(isset($_SESSION['todaySESH'])?$_SESSION['todaySESH']:"") ."", "-1"); //colname
$rsLIVECOMP->bindParam("t", "".(isset($_SESSION['todaySESH'])?$_SESSION['todaySESH']:"") ."", "-1"); //colname1
$rsLIVECOMP->execute();
?>
I want to only show results where the competition start date is less than, or equal to, today's date/time but ALSO where the end date is greater than, or equal to today's date.
I'm trying to only show competitions that are available during their start and end dates.
At present, using the above, it displays any competition regardless of the dates in the database.
Hope you can help. Thank you.
NJ