Best practice is to scope all variables.... Then its not an issue.

Michael T. Tangorre  

> -----Original Message-----
> From: George Abraham [mailto:[EMAIL PROTECTED] 
> Sent: Friday, October 22, 2004 10:41 AM
> To: CF-Talk
> Subject: parameters and query values
> 
> Right,
> So who exactly wins out in the battle of the variable values? 
> 
> I have a parameter declared: FPSiteTypeID
> 
> I have a query (getFieldPlacementSites) that gets a row from 
> the database. One of the columns in that row is FPSiteTypeID. 
> I also have a query (getFieldPlacementSiteTypes) that gets a 
> lookup/mapping of these FPSiteTypeIDs
> 
> There is a select box that I offer for the client to select 
> these FPSiteTypeIDs.
> 
> This is how the flow looks then.
> 
> <code>
> 
> <cfparam name="FPSiteTypeID" default="0"> <cfquery 
> datasource=dsn name=getFieldPlacementSites> SELECT blah1, 
> blah2, FPSiteTypeID FROM thisTable WHERE someID = #ID# </cfquery>
> 
> <cfquery datasource=dsn name=getFieldPlacementSiteTypes> 
> SELECT FieldPlacementSiteTypeID, FieldPlacementSiteType -- 
> (notice the different name from FPSiteTypeID) FROM 
> FieldPlacementSiteTypes </cfquery> <cfloop 
> query=getFieldPlacementSites>
> 
> <select id="FPSiteTypeID" name="FPSiteTypeID"> <cfloop 
> query="getFieldPlacementSiteTypes">
>       <option value="#FieldPlacementSiteTypeID#"<cfif
> FieldPlacementSiteTypeID EQ FPSiteTypeID> 
> selected="selected"</cfif>>#FieldPlacementSiteType#</option>
> </cfloop>
> </select>
> 
> </cfloop>
> 
> </code>
> 
> Well, everytime this is run, the value of FPSiteTypeID in the 
> <cfif > statement comes out to be 0 (the default value) 
> instead of the value from the query (getFieldPlacementSites). Why?
> 
> TIA,
> George
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF 
community.
http://www.houseoffusion.com/banners/view.cfm?bannerid=38

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:182332
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to