Jumping in here a little late, but this looks like you have two fields in
your form named Username.  When there are multiple form fields with the same
name, your browser will submit them as a comma separated list.  Look on your
original form to see it you are perhaps setting a hidden field with the
original username...

HTH,

Jeff Garza

----- Original Message -----
From: "FlashGuy" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, April 03, 2003 10:56 AM
Subject: Re: <cfquery> UPDATE


WTF


Here is my code:

<cfquery name="UpdateUser" datasource="#Request.App.dsn#">
UPDATE login
SET
Username=<cfqueryparam value="#FORM.Username#"
cfsqltype="CF_SQL_LONGVARCHAR">,
Password=<cfqueryparam value="#FORM.Password#"
cfsqltype="CF_SQL_LONGVARCHAR">,
Firstname=<cfqueryparam value="#FORM.Firstname#"
cfsqltype="CF_SQL_LONGVARCHAR">,
Lastname=<cfqueryparam value="#FORM.Lastname#"
cfsqltype="CF_SQL_LONGVARCHAR">,
Level=<cfqueryparam value="#FORM.Level#" cfsqltype="CF_SQL_LONGVARCHAR">,
Access=<cfqueryparam value="#FORM.Access#" cfsqltype="CF_SQL_LONGVARCHAR">,
Status=<cfqueryparam value="#FORM.Status#" cfsqltype="CF_SQL_LONGVARCHAR">
WHERE UserID=<cfqueryparam value="#FORM.UserID#"
cfsqltype="CF_SQL_LONGVARCHAR">
</cfquery>

When I update the password field it doesn't get inserted and then the
username filed gets a duplicate name inserted.

username field = "bob,bob"


If I try setting the password again and hit submit I get.

username field = "bob,bob,bob,bob"

and so on.

The output of the variables for the UserID are:

UsrID: 9,9
FORM.UserID: 9,9

Why is the an extra figure concatenated on the end?





On Thu, 3 Apr 2003 09:28:12 -0800, Bryan Stevenson wrote:

> WHERE #FORM.UserID#
>
> Should be something like:
>
> WHERE User_ID =  #FORM.UserID# (and you should use CFQUERYPARAM here as
> well)
>
> Bryan Stevenson B.Comm.
> VP & Director of E-Commerce Development
> Electric Edge Systems Group Inc.
> t. 250.920.8830
> e. [EMAIL PROTECTED]
>
> ---------------------------------------------------------
> Macromedia Associate Partner
> www.macromedia.com
> ---------------------------------------------------------
> Vancouver Island ColdFusion Users Group
> Founder & Director
> www.cfug-vancouverisland.com
> ----- Original Message -----
> From: "FlashGuy" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Thursday, April 03, 2003 9:16 AM
> Subject: re: <cfquery> UPDATE
>
>
> > Hi,
> >
> > Whats wrong with the syntax below? When I change a field and click the
> submit to run the code below it "adds" the field to the existing field in
> the database.
> > I want to replace it.
> >
> > For example the password is "test". Using my template I enter in "xxx"
> click the submit. When I check the database I have "test,xxx" in the
> password field.
> > I just want "xxx".
> >
> > <cfquery name="UpdateUser" datasource="#Request.App.dsn#">
> > UPDATE login
> > SET
> > Username=<cfqueryparam value="#FORM.Username#"
> cfsqltype="CF_SQL_LONGVARCHAR">,
> > Password=<cfqueryparam value="#FORM.Password#"
> cfsqltype="CF_SQL_LONGVARCHAR">,
> > Firstname=<cfqueryparam value="#FORM.Firstname#"
> cfsqltype="CF_SQL_LONGVARCHAR">,
> > Lastname=<cfqueryparam value="#FORM.Lastname#"
> cfsqltype="CF_SQL_LONGVARCHAR">,
> > Level=<cfqueryparam value="#FORM.Level#"
cfsqltype="CF_SQL_LONGVARCHAR">,
> > Access=<cfqueryparam value="#FORM.Access#"
> cfsqltype="CF_SQL_LONGVARCHAR">,
> > Status=<cfqueryparam value="#FORM.Status#"
cfsqltype="CF_SQL_LONGVARCHAR">
> > WHERE #FORM.UserID#
> > </cfquery>
> >
> >
> > ---------------------------------------------------
> > Colonel Nathan R. Jessop
> > Commanding Officer
> > Marine Ground Forces
> > Guatanamo Bay, Cuba
> > ---------------------------------------------------
> >
> >
> >
> >
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to