When a username is requested, you could query for the username, then check
if the query returned any results.  Decide what you want to happen after and
use a switch on that.  For example:

<cfquery name="checkForUsername">

if checkforusername.recordcount

return user to sign up page with message saying username taken

else

add user

CFRTY will trap the error and control what happens after that only in a more
general sense (and only if said query fails to run at all,  not just return
0 results);, run or display an error template. I would think dealing with a
real eventuality:  that some one tries to create a username that is taken is
best handled explicitly.

-Craig



>>-----Original Message-----
>>From: Todd [mailto:[EMAIL PROTECTED]]
>>Sent: Friday, July 26, 2002 9:24 PM
>>To: CF-Linux
>>Subject: Re: CF Register For Chat Room
>>
>>
>><cftry>
>>         query
>>         <cfcatch type="database">
>>         eek! error!
>>         </cfcatch>
>></cftry>
>>
>>..?
>>
>>At 11:19 AM 7/27/2002 +1000, you wrote:
>>>I've almost finished building a login page for a chatroom in CF. The
>>>last thing I need to fix is on the registration page. I've setup the
>>>MySQL login's database to have the unique attribute for the login id.
>>>Now the problem is that when someone tries to register a login that
>>>already exists I get a messy ODBC error.
>>>
>>>So what I need to know is how can I test whether the login id already
>>>exists? This will allow me to put up a nice HTML page tell the person
>>>that the login id is already taken, that would be much better and
>>>understandable than a messy ODBC error message.
>>>
>>>I think my question is how can i find the success/error status of a SQL
>>>query from within CF?
>>>
>>>Thanks.  Paul
>>>
>>>
>>>
>>>
>>
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-linux%40houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_linux or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to