Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table insertion problems

Status
Not open for further replies.

shawntbanks

Programmer
Oct 29, 2003
48
CA
I am having a problem trying to insert a variable into a record in a table.

<cfquery datasource=&quot;market&quot;>
insert into saleitem_tmp (subcategoryid, location, itemname, ShortDescription,
longDescription, itemprice, featured, begindate, enddate, picture1, picture2, picture3, picture4)
values(#arylocalcart[whichad].subcategoryid#, '#trim(arylocalcart[whichad].location)#', '#Trim(arylocalcart[whichad].itemname)#',
'#trim(arylocalcart[whichad].Short_Description)#', '#trim(arylocalcart[whichad].long_Description)#', '#trim(arylocalcart[whichad].itemprice)#',
'#trim(arylocalcart[whichad].featured)#', #arylocalcart[whichad].begindate#, #arylocalcart[whichad].enddate#,
'#trim(arylocalcart[whichad].picture1)#',
'#trim(arylocalcart[whichad].picture2)#',
'#trim(arylocalcart[whichad].picture3)#',
'#trim(arylocalcart[whichad].picture4)#')</cfquery>

the part which is red is the problem area. It is a text field originaly and some of the text some time will look like this

Living rm w/12' ceilings

PROBLEM (') this character. I get an error because of this.

Line 4: Incorrect syntax near 'ceilings'

Anybody got any ideas
 
No, UrlEncodedFormat is for placing variables in a URL.
For a Query, if you're using something like SQL Server or Oracle, try <cfqueryparam>

<cfqueryparam value=&quot;#trim(arylocalcart[whichad].long_Description)#&quot; cfsqltype=&quot;CF_SQL_VARCHAR&quot;>




Hope This Helps!

Ecobb

&quot;Alright Brain, you don't like me, and I don't like you. But lets just do this, and I can get back to killing you with beer.&quot; - Homer Simpson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top