[thelist] CF Question
Thompson, Amy
AThompson at randomhouse.com
Wed May 10 08:53:52 2000
I tried removing the quotes yesterday and got an Oracle improper SQL
terminator error. Why would the value not be resolved? By putting it in
quotes Oracle see '#form.reader_id#' as the value so when I remove the
quotes the DBMS doesn't like #form.reader_id# as a value and the # as a SQL
terminator....UGH!
Thanks for all teh help Jeff-
Amy
-----Original Message-----
From: Jeff [mailto:jeff@members.evolt.org]
Sent: Wednesday, May 10, 2000 12:59 AM
To: thelist@lists.evolt.org
Subject: Re: [thelist] CF Question
amy,
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: Thompson, Amy <AThompson@randomhouse.com>
:
: <CFQUERY .....>
: update reader_table
: set read_status=1
: where reader_id='#form.reader_id#'
: </CFQUERY>
:
: This returns an oracle error code of 1722 - invalid
: number.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
it's an invalid number because you've wrapped the value in single-quotes.
try this instead:
<CFQUERY .....>
UPDATE reader_table
SET read_status=1
WHERE reader_id = #form.reader_id#
</CFQUERY>
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: In an attempt to debug this, I included some javascript
: message boxes to show the value of reader_id at
: different points in the code like this:
:
: <cfif IsDefined("form.reader_id")>
: <cfset tmp=#form.reader_id#>
:
: <script language="javascript">
: alert (tmp);
: </script>
:
: </cfif>
:
: when I try this i get a javascript error " 'tmp' is undefined"
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tmp is undefined because you're trying to call a javascript variable named
tmp which doesn't exist. if you want to see the value of the cf variable
tmp, then you'll have to wrap the variable in hash marks (#) and the
<script> block with <cfoutput>. you may also want to use single or double
quotes in your alert() so it treats it as a string. one final note, you
don't need to wrap cf variables in hashes if they're within cf tags. this
is what it should look like:
<cfif IsDefined('form.reader_id')>
<cfset tmp = form.reader_id>
<script language="JavaScript" type="text/javascript">
<!--
alert('#tmp#');
// -->
</script>
</cfif>
good luck,
.jeff
name://jeff.howden
game://web.development
http://www.evolt.org/
mailto:jeff@members.evolt.org
---------------------------------------
For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt !