Copy link to clipboard
Copied
I would like to have different conferences or events disappear after the "createdatetime" variable of the event has met the condition i had set in my cfif statement. The problem i am running into is that when i set my "<cfif #now()# gte", the date of my event, i want the particular event to remove itself from being displayed on the webpage. Howver all of the events that are less than and greater than that the #now()# variable date removes themselves from displaying on the webpage as well. Am i using the right syntax? Is there a way to modify this syntax so that only the date for the event that meet the requirement of the cfif statement stop displaying and nothing else? Below is the syntax i used: |
<cfif #now()# gte "CreateDateTime (event.evebeginyear, event.evebeginmonth, event.evebeginday, event.evebeginhour, event.evebeginminute, event.evebeginsecond)" ><cfelse>
<cfoutput query="events">
Events from Database of various past an present dates
/cfoutput></cfif>
Copy link to clipboard
Copied
You might be better off applying this logic to the query instead of the display. If the intent is to display events in the future and nothing else, why bring back events from the past in your query?
Copy link to clipboard
Copied
<cfif #now()# gte "CreateDateTime (event.evebeginyear, event.evebeginmonth, event.evebeginday, event.evebeginhour, event.evebeginminute, event.evebeginsecond)" >
No, this syntax is incorrect. The left-hand side of the GTE operator is a date object, whereas the right-hand side is a string. Correct is:
<cfif now() gte createDateTime (event.evebeginyear, event.evebeginmonth, event.evebeginday, event.evebeginhour, event.evebeginminute, event.evebeginsecond)>
Copy link to clipboard
Copied
I think the logic is applied above the loop. It should be inside the loop like:
<cfoutput query="xxxx">
<cfif>
<cfelse>
</cfif>
</cfouput>