Having a issue with coldfusion. I just need a simple way to see if a date has passed and if so to update a field in a database. basically I have events showing on a page but want to remove the event automactically when it is over. Thanks for the help in advance..

While you can do this in coldfusion, it's probably faster to do it directly in SQL.

<cfquery name="getEvents" datasource="">
    SELECT id, name, description, date
    FROM events
    WHERE date > now()
</cfquery>

If you didn't store the date as a date field in the DB, then you can do a Query of Queries and do essentially the same thing.

Hope this helps!

Member Avatar for jardrake

You first need to select the events using WHERE date > now()then loop through them using

<cfloop query="queryName">
then write your update query inside here for each article
</cfloop>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.