Skip to main content
July 3, 2006
Answered

CFML duplicate entries

  • July 3, 2006
  • 3 replies
  • 403 views
Hello,

I am having trouble, I can't get the CFML to not duplicate the Users in my table. Except the user at the top of my table. but it won’t validate the rest of the users I have on my Database just the one at the top.

<cfquery name="checkusers" datasource="ukgl.co.uk">
SELECT UserName
FROM users
</cfquery>

<cfif #Form.Username# is "#checkusers.Username#"><cfoutput>#Form.Username# is already in use by another User</cfoutput><cfoutput>#checkusers.Username#</cfoutput><cfelse>

! Insert Code !

</cfif>

There’s the code I have.

Any help is greatly appreciated.

Thanks
This topic has been closed for replies.
Correct answer Newsgroup_User
You are grabbing your entire membership list with the query but then not
using a cfoutput hence you are getting only the first record.

Change the SQL statement to

SELECT UserName
FROM users
WHERE UserName = '#Form.Username#'

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"Hugh Neale" <webforumsuser@macromedia.com> wrote in message
news:e8bcii$im1$1@forums.macromedia.com...
> Hello,
>
> I am having trouble, I can't get the CFML to not duplicate the Users in my
> table. Except the user at the top of my table. but it won?t validate the
> rest
> of the users I have on my Database just the one at the top.
>
> <cfquery name="checkusers" datasource="ukgl.co.uk">
> SELECT UserName
> FROM users
> </cfquery>
>
> <cfif #Form.Username# is "#checkusers.Username#"><cfoutput>#Form.Username#
> is
> already in use by another
> User</cfoutput><cfoutput>#checkusers.Username#</cfoutput><cfelse>
>
> There?s the code I have so far.
>
> Any help is greatly appreciated.
>
> Thanks
>
>


3 replies

July 6, 2006
god im stupid
Newsgroup_UserCorrect answer
Inspiring
July 6, 2006
You are grabbing your entire membership list with the query but then not
using a cfoutput hence you are getting only the first record.

Change the SQL statement to

SELECT UserName
FROM users
WHERE UserName = '#Form.Username#'

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"Hugh Neale" <webforumsuser@macromedia.com> wrote in message
news:e8bcii$im1$1@forums.macromedia.com...
> Hello,
>
> I am having trouble, I can't get the CFML to not duplicate the Users in my
> table. Except the user at the top of my table. but it won?t validate the
> rest
> of the users I have on my Database just the one at the top.
>
> <cfquery name="checkusers" datasource="ukgl.co.uk">
> SELECT UserName
> FROM users
> </cfquery>
>
> <cfif #Form.Username# is "#checkusers.Username#"><cfoutput>#Form.Username#
> is
> already in use by another
> User</cfoutput><cfoutput>#checkusers.Username#</cfoutput><cfelse>
>
> There?s the code I have so far.
>
> Any help is greatly appreciated.
>
> Thanks
>
>


July 5, 2006
*bump* someone help ... please