$GetCPLForID_sql
"; $GetCPLForID_result = mysql_query($GetCPLForID_sql); $GetCPLForID_myrow = mysql_fetch_array($GetCPLForID_result); $var_Centre = $GetCPLForID_myrow['col_Centre']; $var_Phase = $GetCPLForID_myrow['col_Phase']; $var_Lot = $GetCPLForID_myrow['col_Lot']; $var_Today = date("Y-m-d"); // today + 3 months should do it. $var_EndRangeDate = date("Y-m-d",mktime(0,0,0,date("m")+3,date("d"),date("Y"))); // echo "c: $var_Centre p: $var_Phase l: $var_Lot"; if($var_BaseMode == "All") { if($var_ChosenType == "All") { echo "
All Events
"; $var_WhereClause = "where col_ActiveYN = 'Yes' and col_ScheduleType = 'Events'"; } else { echo "
All $var_ChosenType Events
"; $var_WhereClause = "where col_Type='$var_ChosenType' and col_ActiveYN = 'Yes' and col_ScheduleType = 'Events'"; } } if($var_BaseMode == "uc") { // today + 3 months should do it. $var_EndDateRange = date("Y-m-d",mktime(0,0,0,date("m")+3,date("d"),date("Y"))); if($var_ChosenType == "All") { echo "
Upcoming Events
"; $var_WhereClause = "where col_StartDate > '$var_Today' and col_EndDate < '$var_EndDateRange' and col_ActiveYN = 'Yes' and col_ScheduleType = 'Events'"; } else { echo "
Upcoming $var_ChosenType Events
"; $var_WhereClause = "where col_StartDate > '$var_Today' and col_EndDate < '$var_EndDateRange' and col_Type='$var_ChosenType' and col_ActiveYN = 'Yes' and col_ScheduleType = 'Events'"; } } if($var_BaseMode == "pa") { // today - 3 months should do it. $var_StartDateRange = date("Y-m-d",mktime(0,0,0,date("m")-3,date("d"),date("Y"))); if($var_ChosenType == "All") { echo "
Past Events
"; $var_WhereClause = "where col_StartDate < '$var_Today' and col_EndDate > '$var_EndDateRange' and col_ActiveYN = 'Yes' and col_ScheduleType = 'Events'"; } else { echo "
Past $var_ChosenType Events
"; $var_WhereClause = "where col_StartDate < '$var_Today' and col_EndDate > '$var_EndDateRange' and col_Type='$var_ChosenType' and col_ActiveYN = 'Yes' and col_ScheduleType = 'Events'"; } } $GetPrepEvents_sql = " select col_ScheduledEventsID, col_Title, col_Description, col_StartDate, col_StartTime, col_EndDate, col_EndTime, col_Type, col_Centre, col_Phase, col_Lot from tb_ScheduledEvents $var_WhereClause "; // echo $GetPrepEvents_sql; $GetPrepEvents_result = mysql_query($GetPrepEvents_sql); $var_ResultsCount = mysql_numrows($GetPrepEvents_result); if($var_ResultsCount) { while($GetPrepEvents_myrow = mysql_fetch_Array($GetPrepEvents_result)) { $var_incCentres = $GetPrepEvents_myrow['col_Centre']; // if this event applies to this Centre, if(stristr($var_incCentres, $var_Centre)) { //if this event applies to this phase or All $var_incPhases = $GetPrepEvents_myrow['col_Phase']; if(stristr($var_incPhases, $var_Phase)||stristr($var_incPhases, "All")) { // if this event applies to this lot or All $var_incLots = $GetPrepEvents_myrow['col_Lot']; if(stristr($var_incLots, $var_Lot)|| stristr($var_incLots, "All")) { // then we're good to show this event to this user. :-/ $var_incID = $GetPrepEvents_myrow['col_ScheduledEventsID']; $var_incTitle = $GetPrepEvents_myrow['col_Title']; $var_incDescription = $GetPrepEvents_myrow['col_Description']; $var_incStartDate = $GetPrepEvents_myrow['col_StartDate']; $var_incStartTime = $GetPrepEvents_myrow['col_StartTime']; $var_incEndDate = $GetPrepEvents_myrow['col_EndDate']; $var_incEndTime = $GetPrepEvents_myrow['col_EndTime']; $var_incType = $GetPrepEvents_myrow['col_Type']; $var_Mon = date("M",strtotime($var_incStartDate)); $var_Day = date("j",strtotime($var_incStartDate)); $var_Year = date("Y",strtotime($var_incStartDate)); echo "
$var_Mon
$var_Day
$var_Year
$var_incTitle
$var_incType
"; if($var_incStartDate == $var_incEndDate) { $var_F_StartTime = date("g:i a",(date(strtotime($var_incStartTime)))); $var_F_EndTime = date("g:i a",(date(strtotime($var_incEndTime)))); echo "$var_F_StartTime to $var_F_EndTime"; } else { // change dates to Dayname, Month ddth, 2010. $var_F_StartDate = date("l, F jS, Y",date(strtotime($var_incStartDate))); $var_F_EndDate = date("l, F jS, Y",date(strtotime($var_incEndDate))); // change times to 12hr. $var_F_StartTime = date("g:i a",(date(strtotime($var_incStartTime)))); $var_F_EndTime = date("g:i a",(date(strtotime($var_incEndTime)))); echo "$var_F_StartDate at $var_F_StartTime to $var_F_EndDate at $var_F_EndTime"; } echo "
More Info
"; } } } } } // else, no results. else { echo "
No events match this query.
"; } ?>