MACROMEDIA COLFUSION MX 7-CFML Reference page 546

Cfml reference
Hide thumbs Also See for COLFUSION MX 7-CFML:
Table of Contents

Advertisement

<!--- if numbers passed, then use those --->
<cfif IsDefined("form.value")>
<cfset value = form.value>
</cfif>
<cfif IsDefined("form.type")>
<cfset type = form.type>
</cfif>
<cfquery name="GetMessages" datasource="cfdocexamples">
SELECT
UserName, Subject, Posted
FROM
Messages
</cfquery>
<p>This example uses DateAdd to determine when a message in
the database will expire. Currently, messages older
than <cfoutput>#value#</cfoutput>
<cfswitch expression="#type#">
<cfcase value="yyyy">years</cfcase>
<cfcase value="q">quarters</cfcase>
<cfcase value="m">months</cfcase>
<cfcase value="y">days of year</cfcase>
<cfcase value="w">weekdays</cfcase>
<cfcase value="ww">weeks</cfcase>
<cfcase value="h">hours</cfcase>
<cfcase value="n">minutes</cfcase>
<cfcase value="s">seconds</cfcase>
<cfdefaultcase>years</cfdefaultcase>
</cfswitch>
are expired.
<table>
<tr>
<td>UserName</td>
<td>Subject</td>
<td>Posted</td>
</tr>
<cfoutput query="GetMessages">
<tr>
<td>#UserName#</td>
<td>#Subject#</td>
<td>#Posted# <cfif DateAdd(type, value, posted) LT Now()><font
color="red">EXPIRED</font></cfif></td>
</tr>
</cfoutput>
</table>
<cfform action="#CGI.Script_Name#" method="post">
Select an expiration value:
<cfinput type="Text" name="value" value="#value#" message="Please enter whole
numbers only" validate="integer" required="Yes">
<select name="type">
546
Chapter 3: ColdFusion Functions

Advertisement

Table of Contents
loading

This manual is also suitable for:

Colfusion mx 7 - installing and using coldfusion mx

Table of Contents