CFQuery Select and single quotes in string

2011-06-10 Thread Jim Brundle

I'm doing a look up like this:

cfquery datasource=#DSN# name=GetResults
  SELECT Formation, Play, BallCarrier, YardsGained, Result
  FROM PlaysCalled
  WHERE (((PlaysCalled.Formation)=#Form.Formation#) AND  
((PlaysCalled.Play)=#Form.Play#) AND 
((PlaysCalled.BallCarrier)=#Form.BallCarrier#));
/cfquery

In some cases, the Ball Carrier's name has a single quote in it.  In these 
cases, the search doesn't find them.  

So for instance, it finds Bob Jones but not D'Quan Black.

Do I use cfqueryparam to resolve this?  I'm using cfqueryparam when I insert 
the data into the database, but when I use the line:
cfqueryparam value=#Trim(GetPlay.BallCarrier)# 
cfsqltype=CF_SQL_LONGVARCHAR it doesn't find anything.

Thanks,

Jim 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345144
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Best Practice for multi-page form

2011-06-05 Thread Jim Brundle

I have a multi-page form (survey) where the user can go forward and back 
through the survey.  I want to save the entries from each page so that I can 
repopulate the page if the user goes back to it.  I expect to have 30-40 
surveys a day.  Is it better to store the data for the survey in an array of 
structures (CategoryID, QuestionID, AnswerValue) and then submit all the data 
in one pass when the user finishes the form, or save each page to the database 
as the user moves through the form, and then go back to the database for the 
data if they go back to an earlier page?  I've always thought it was best to 
only hit the database once at the end, but I've  been reading that some people 
recommend going to the database every time a page is submitted, because storing 
the data as an array of structures takes up RAM.


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345095
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm