Skip to main content
October 13, 2010
Answered

beginner help

  • October 13, 2010
  • 1 reply
  • 1282 views

Hey All,

I am working on a website and they are using coldfusion. I have neve dealt with coldfusion before and given the time I am working on learning it. The owner of the site is having an issue he would like fixed asap and I just don't have the time to learn coldfusion enough to fix it. With that said I know what is causing the problem and I am 99% sure I have the sollution, I just don't know how to put them together.

The issue is the user copies all his unput data from a word file and the quotes are not being read properly. The current code reads:

<cfoutput>
          insert into property (FEATURED, APPROVED, LISTING_MEMBER_ID1A, LISTING_MEMBER_ID1B, TABTYPE, PHOTO_PATHJPG, MLSNUM, LIST_PRICE, HOUSENUM, STREET, STR_TYPE, STR_DIR, UNITNUM, CITY, PROPCODE, AGE, PROPSIZE1, PROPSIZE2, LOTSIZE, PROPOVER, FEATURES1, FEATURES2, FEATURES3, FEATURES4, FEATURES5, FEATURES6, FEATURES7, EXT1, EXT2, EXT3, OUTDOOR1, OUTDOOR2, OUTDOOR3, WATER1, SEWER, NUMRENTAL, FULLBATHS, HALFBATHS, NUMBEDS, STYLE1, STYLE2, FOUND1, LEGALDESC, TYPE1, TYPE2, TYPE3, HEATING1, HEATING2, HEATING3, EXTFEA1, EXTFEA2, EXTFEA3, FIREPROT1, GARAGET1, PROPZONE, REMKS)
          values (#vfeed[1]#, #vfeed[2]#,  #vfeed[6]#, #vfeed[7]#, '#vfeed[19]#', #vfeed[20]#, #vfeed[21]#, #vfeed[22]#, #vfeed[23]#, '#vfeed[24]#', '#vfeed[25]#', '#vfeed[26]#', #vfeed[27]#, '#vfeed[28]#', '#vfeed[29]#', '#vfeed[30]#', '#vfeed[34]#', '#vfeed[35]#', '#vfeed[36]#', '#vfeed[38]#', '#vfeed[39]#', '#vfeed[40]#', '#vfeed[41]#', '#vfeed[42]#', '#vfeed[43]#', '#vfeed[44]#', '#vfeed[45]#', '#vfeed[46]#', '#vfeed[47]#', '#vfeed[48]#', '#vfeed[60]#', '#vfeed[61]#', '#vfeed[62]#', '#vfeed[63]#', '#vfeed[67]#', #vfeed[76]#, #vfeed[82]#, #vfeed[83]#, #vfeed[84]#, '#vfeed[86]#', '#vfeed[87]#', '#vfeed[91]#', '#vfeed[97]#', '#vfeed[98]#', '#vfeed[99]#', '#vfeed[100]#', '#vfeed[101]#', '#vfeed[102]#', '#vfeed[103]#', '#vfeed[105]#', '#vfeed[106]#', '#vfeed[107]#', '#vfeed[117]#', '#vfeed[122]#', '#vfeed[126]#', '#vfeed[127]#')
     </cfoutput>
     <cfquery dbtype="dynamic" connectstring="#feedconn#">
          insert into property (FEATURED, APPROVED, LISTING_MEMBER_ID1A, LISTING_MEMBER_ID1B, TABTYPE, PHOTO_PATHJPG, MLSNUM, LIST_PRICE, HOUSENUM, STREET, STR_TYPE, STR_DIR, UNITNUM, CITY, PROPCODE, AGE, PROPSIZE1, PROPSIZE2, LOTSIZE, PROPOVER, FEATURES1, FEATURES2, FEATURES3, FEATURES4, FEATURES5, FEATURES6, FEATURES7, EXT1, EXT2, EXT3, OUTDOOR1, OUTDOOR2, OUTDOOR3, WATER1, SEWER, NUMRENTAL, FULLBATHS, HALFBATHS, NUMBEDS, STYLE1, STYLE2, FOUND1, LEGALDESC, TYPE1, TYPE2, TYPE3, HEATING1, HEATING2, HEATING3, EXTFEA1, EXTFEA2, EXTFEA3, FIREPROT1, GARAGET1, PROPZONE, REMKS)
          values (#vfeed[1]#, #vfeed[2]#,  #vfeed[6]#, #vfeed[7]#, '#vfeed[19]#', #vfeed[20]#, #vfeed[21]#, #vfeed[22]#, #vfeed[23]#, '#vfeed[24]#', '#vfeed[25]#', '#vfeed[26]#', #vfeed[27]#, '#vfeed[28]#', '#vfeed[29]#', '#vfeed[30]#', '#vfeed[34]#', '#vfeed[35]#', '#vfeed[36]#', '#vfeed[38]#', '#vfeed[39]#', '#vfeed[40]#', '#vfeed[41]#', '#vfeed[42]#', '#vfeed[43]#', '#vfeed[44]#', '#vfeed[45]#', '#vfeed[46]#', '#vfeed[47]#', '#vfeed[48]#', '#vfeed[60]#', '#vfeed[61]#', '#vfeed[62]#', '#vfeed[63]#', '#vfeed[67]#', #vfeed[76]#, #vfeed[82]#, #vfeed[83]#, #vfeed[84]#, '#vfeed[86]#', '#vfeed[87]#', '#vfeed[91]#', '#vfeed[97]#', '#vfeed[98]#', '#vfeed[99]#', '#vfeed[100]#', '#vfeed[101]#', '#vfeed[102]#', '#vfeed[103]#', '#vfeed[105]#', '#vfeed[106]#', '#vfeed[107]#', '#vfeed[117]#', '#vfeed[122]#', '#vfeed[126]#', '#vfeed[127]#')
     </cfquery>     

and here is the solution:

http://www.cflib.org/udf/ConvertSpecialChars

If anyone could even point in the right direction on how to put these two together, I really have zero experience with coldfusion.

Thanks for any help!

    This topic has been closed for replies.
    Correct answer Dave Watts

    Yes, that looks like it would work.

    Dave Watts, CTO, Fig Leaf Software

    http://www.figleaf.com/

    http://training.figleaf.com/

    Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on

    GSA Schedule, and provides the highest caliber vendor-authorized

    instruction at our training centers, online, or onsite.

    1 reply

    Community Expert
    October 13, 2010

    I think this solution is more complete:

    http://cflib.org/index.cfm?event=page.udfbyid&udfid=725

    But anyway, you'd end up with something like this:

    <cfquery dbtype="dynamic" connectstring="#feedconn#">
    insert into property (...)
    values (#vfeed[1]#, #vfeed[2]#,  #vfeed[6]#, #vfeed[7]#, '#DeMoronize(vfeed[19])#', ...)
    </cfquery>

    Also, you probably want to use CFQUERYPARAM around all of those values:

    <cfquery dbtype="dynamic" connectstring="#feedconn#">
    insert into property (...)
    values (<cfqueryparam cfsqltype="cf_sql_integer" value="#vfeed[1]#">, ... <cfqueryparam cfsqltype="cf_sql_varchar" value="#DeMoronize(vfeed[19])#">, ...)
    </cfquery>

    Dave Watts, CTO, Fig Leaf Software

    http://www.figleaf.com/

    http://training.figleaf.com/

    Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on

    GSA Schedule, and provides the highest caliber vendor-authorized

    instruction at our training centers, online, or onsite.

    Dave Watts, Eidolon LLC
    October 16, 2010

    Thank you, That really helped! I still do not have it working, as I have no idea what I am doing; but I think I know how to make it work, if someone could just check this for me. There is already a loop that checks for empty spaces and removes them that looks like this:

    <cfloop index="j" from="1" to="127">
            <cfif len(trim(vfeed)) is 0><cfset vfeed = ""></cfif>
        </cfloop>

    Could I call the DeMoronize function in there? Maybe it will look something like this;

    <cfloop index="j" from="1" to="127">
            <cfif len(trim(vfeed)) is 0><cfset vfeed = ""></cfif>
            <cfset vfeed = DeMoronize(vfeed)>
        </cfloop>

    Thanks again for any help.

    Dave WattsCommunity ExpertCorrect answer
    Community Expert
    October 16, 2010

    Yes, that looks like it would work.

    Dave Watts, CTO, Fig Leaf Software

    http://www.figleaf.com/

    http://training.figleaf.com/

    Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on

    GSA Schedule, and provides the highest caliber vendor-authorized

    instruction at our training centers, online, or onsite.

    Dave Watts, Eidolon LLC