Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Getting Started / October 2004



Tip: Looking for answers? Try searching our database.

increment DB field by 1

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lossed - 26 Oct 2004 09:06 GMT
Hi there,

I have a radio button field, form.SlopAnswer,  that dictates which db field
should be incremented by one, but I'm not sure how to update the DB.
The value of the form field is exactly that of the db field, but could be
any one of four different values/db fields.
So for the update I tried something like:

<cfquery name="qSlopUpdate" datasource="mpg">
 update slop
set slop.#form.SlopAnswer# = (slop.#form.SlopAnswer# + 1) where qID = 1
</cfquery>

The table is called slop, the qID is the auto_increment ID primary key
assigned to the record I need to update.
Can someone please offer some pointers and perhaps any links that
specifically deal with arithmetic in queries?

Signature

Tks,
Lossed
--------------------------------------------------------------------------------------------------------
When the only tool you have is a hammer, everything looks like a nail :-)
--------------------------------------------------------------------------------------------------------

TheFunnyMonkey - 29 Oct 2004 19:21 GMT
seem really dangerous still.  hacker could inject own field name that not
number or number out of range and get access to database.  example above still
allow letter.  shoult be: &lt;cfset form.slopanswer =
ReReplaceNoCase(form.slopanswer, '[^0-9]', '', 'all')&gt; then compare number
use cfif.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.