House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Mac (CF-Mac)

CFQuery Questions

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Hi All,
J. Todd Slack-Moehrle
01/09/09 06:04 P
Immediate error I see:
Peter Bell
01/09/09 06:09 P
Thanks for the advice Peter. I appreciate it.
J. Todd Slack-Moehrle
01/09/09 06:55 P
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
J. Todd Slack-Moehrle
01/09/2009 06:04 PM

Hi All, Getting more knowledge of CF. I have questions on CFQuery and URL Parameters. Is the following code right: <!---give a default value to avoid error---> <cfparam name="URL.queryName" default=""> <!---scope out if it is not null---> <cfif isdefined("URL.queryName") and #URL.queryName# NEQ "">     <!--- Query the Content table from MySQL to get the content we are to display --->          <CFSET theSQL="SELECT queryName, title, content FROM content WHERE queryName = " #URL.queryName# >              <cfquery name="getContent" datasource="#application.dsn#">#theSQL# </cfquery>          <!--- for testing only --->     <CFOUTPUT>#theSQL#</CFOUTPUT>               <cfif getContent.recordCount EQ 1>        <!--- we have records --->                      <cfoutput query="getContent">            #content#         </cfoutput>     <cfelse>        <!--- we dont have any data so error --->            NO DATA     </cfif> </cfif> I get CF Construct errors and I know it is due to the CFSet statement, but I don¹t see how to do it correct. Advice? -Jason

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Peter Bell
01/09/2009 06:09 PM

Immediate error I see: >    <CFSET theSQL="SELECT queryName, title, content FROM content WHERE > queryName = " #URL.queryName# > Should be >    <CFSET theSQL="SELECT queryName, title, content FROM content WHERE > queryName = '#URL.queryName#' " > But once you have that working, check out the ColdFusion docs on   cfqueryparam or you're gonna get hacked. Google "sql injection attack". Best Wishes, Peter On Jan 9, 2009, at 5:55 PM, J. Todd Slack-Moehrle wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Peter Bell
01/09/2009 06:09 PM

Oh, and you might want to choose cf talk for these questions - this   list is for questions relating to Mac computers and CF On Jan 9, 2009, at 5:55 PM, J. Todd Slack-Moehrle wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
J. Todd Slack-Moehrle
01/09/2009 06:55 PM

Thanks for the advice Peter. I appreciate it. -Jason On 1/9/09 3:00 PM, "Peter Bell" <pbell@systemsforge.com> wrote: ----- Excess quoted text cut - see Original Post for more -----


<< Previous Thread Today's Threads Next Thread >>

Search cf-mac

May 21, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference