I also like this method:
<cfparam name="id" default="0">
<cfset id = int(val(id))>

On Jan 23, 2008 11:24 AM, Robert Harrison <[EMAIL PROTECTED]>
wrote:

> > > What the best approach to controling the error messages that appear
> when
> > say for example, someone removes an integer from a url scope?
>
>
> Well, you could use error handling, but I think errors are best kept out
> of
> the users face. For url scope you could use something like this:
>
> <!--- verifies id is a positive integer or creates one eq zero to prevent
> SQL error --->
> <cfparam name="id" default="">
>        <cfif IsNumeric(id) is "false">
>                <cfset id="0">
>        </cfif>
>        <cfif id LT 0>
>                <cfset id="0">
>        </cfif>
>
> Now, no matter what you've got an ID that is a positive integer and you
> can
> run an SQL query against it without an error. So, if you get no returns
>
> <cfif myquery.recordcount lt 1>
> Sorry, can't a match
> <cfelse>
> OUTPUT QUERY NOW
> </cfif>
>
>
>
> Robert B. Harrison
> Director of Interactive services
> Austin & Williams
> 125 Kennedy Drive, Suite 100 Hauppauge NY 11788
> T : 631.231.6600 Ext. 119
> F : 631.434.7022
> www.austin-williams.com
>
> Great advertising can't be either/or... It must be &.
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297136
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to