I typed

<cfoutput>#PreserveSingleQuotes(form.Content)#</cfoutput>
<cfoutput>#form.Content#</cfoutput>
<cfabort>

I get
adsfadsf'llll adsfadsf'llll 

which is correct

I think i Need a 
adsfadsf''llll to go in

-----Original Message-----
From: Hayes, David [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 01, 2000 11:26 AM
To: CF-Talk
Subject: RE: preservesinglequotes


You don't want to preserve the single quotes, you want to escape them. 

Output your query string to the screen; you're probably getting something
like 
VALUES('This sentance isn't free of single quotes.', ...) which will bomb
the insert or update.  

You'll need to escape or replace the single quotes.  What happens if you
simply remove PreserveSingleQuotes?

-----Original Message-----
From: Won Lee [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 01, 2000 9:59 AM
To: CF-Talk
Subject: preservesinglequotes


Any help would be really greatful.

I have a form page where the user enters a header, content, and date for a
pressrelease
the action page should insert or update the DB.
Except the ' is causing problems

here is the code running 4.5 with Oracle 7.3 database:


<cfparam name="form.PressReleaseID" default="0">
<cfif form.PressReleaseID EQ 0>
        <cfquery name="insertArticle" datasource="#application.dsn#">
                INSERT INTO PressRelease
                        (Header, Content, PressReleaseDate)
                VALUES
                        ('#PreserveSingleQuotes(form.header)#',
'#PreserveSingleQuotes(form.Content)#', TO_DATE('#form.PressReleaseDate#',
'mm/dd/yyyy'))
        </cfquery>
        
<cfelse>
        <cfquery name="update" datasource="#application.dsn#">
                UPDATE  PressRelease
                SET 
                        Header = '#PreserveSingleQuotes(form.Header)#',
                        Content = '#PreserveSingleQuotes(form.Content)#',
                        PressReleaseDate =
TO_DATE('#form.PressReleaseDate#', 'mm/dd/yyyy')
                WHERE PressReleaseID = #form.PressReleaseID#
        </cfquery>
        
</cfif>


<cflocation url="press_release_list.cfm" addtoken="no">

----------------------------------------------------------------------------
--------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a
message with 'unsubscribe' in the body to [EMAIL PROTECTED]
----------------------------------------------------------------------------
--------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a
message with 'unsubscribe' in the body to [EMAIL PROTECTED]
------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to