• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Need some Help with CFUPDATE into MySQL

New Here ,
Dec 08, 2011 Dec 08, 2011

Copy link to clipboard

Copied

Hi

I am trying to update a MySQL database with a Coldfusion Form which has brought in the information from another form.  The Form action for the update form is as follows:

<form action="update_sup.cfm?GID=#qsupname.SupplierCode#" method="post">

This bit seems to work in so far as it generates a URL that includes the Supplier Code:

www.website.com/update_sup.cfm?GID=193BA3BE-C09F-087E-DACCEE9702D6C5C1

But the SQL query doesn't actually update:

SQL Queries

  CFUPDATE (Datasource=kw5336, Time=0ms, Records=0) in /website/update_sup.cfm @ 22:27:00.000

update Suppliers set SupplierName=?,SalesRepName=?,SalesRepPhone=?,Address1=?,Address2=?,Notes=? where SupplierCode=?

The Form Fields in the Debug show the changes:

Form Fields:

FIELDNAMES=SUPCODE,SUPNAME,SUPADDR1,SUPADDR2,SUPCITY,SUPPCODE,SUPPTERMS,SUPREPNAME,SUPREPPHONE,SUPREPEMAIL,SUPNOTES

SUPADDR1=Unit 55 Portland Drive

SUPADDR2=Kiln Farm

SUPCITY=Milton Keynes

SUPCODE=193BA3BE-C09F-087E-DACCEE9702D6C5C1

SUPNAME=SupplierF

SUPNOTES=

SUPPCODE=MK17 2RB

SUPPTERMS=30

SUPREPEMAIL=p.argent@supplierf.co.uk

SUPREPNAME=Paul Argenta

SUPREPPHONE=01555 123456

What have I missed??

TOPICS
Getting started

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Dec 08, 2011 Dec 08, 2011

Look at the parameters passed to your database.  It's possible that you are only using the part of the GID up to the first hyphen.  If so, you can urlencode the variable or send it as a hidden form field instead.  I'd do the latter myself because I don't like having both url and form variables to deal with.

Votes

Translate

Translate
LEGEND ,
Dec 08, 2011 Dec 08, 2011

Copy link to clipboard

Copied

Look at the parameters passed to your database.  It's possible that you are only using the part of the GID up to the first hyphen.  If so, you can urlencode the variable or send it as a hidden form field instead.  I'd do the latter myself because I don't like having both url and form variables to deal with.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Dec 08, 2011 Dec 08, 2011

Copy link to clipboard

Copied

SUPCODE, ..., SUPPCODE

There are also two fields with very similar names. Is it possible the query is mixing them up?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 08, 2011 Dec 08, 2011

Copy link to clipboard

Copied

Are you sure it's not updating? I don't see any evidence of that from the example you posted. I don't think it shows a value for records updated in the debug output when you run an update.

Dave Watts, CTO, Fig Leaf Software

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Dec 08, 2011 Dec 08, 2011

Copy link to clipboard

Copied

I don't think it shows a value for records updated in the debug output when you run an update.

I believe CF9 does display the number of records updated.  At least with a "regular" update.  But I agree that is not a very robust test.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 09, 2011 Dec 09, 2011

Copy link to clipboard

Copied

LATEST

Can I just say a big THANK YOU to all you lovely people who responded so quickly.  It turned out to be a typo but the responses have helped me with other ideas so that was really wonderful.

I like this place!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation