Don, the problem is that you are trying to output a complex object as a string.
You need to do one of:
- use cfdump to have CF display your query as HTML;
- manually convert your query to a string;
- extract the appropriate fields and output those instead;
- change the function to return a string instead;
Also note that you do not need/want to put the function inside the loop.
For example, I suspect this code is closer to what you want to do:
(note how the function returntype and cfreturn have changed)
<cffunction name="getProduct" access="public" output="no" returnType="string">
<cfargument name="id" type="numeric" required="yes">
<cfset var data = "">
<cfquery name="data" datasource="myDSN">
SELECT pname
FROM product
where id= <cfqueryparam value="#Arguments.id#"
cfsqltype="cf_sql_integer"/>
</cfquery>
<cfreturn data.pname >
</cffunction>
<cfoutput query="myQuery">
...
<cfif conditionX eq 1>
#getProduct(3)#
</cfif>
</cfoutput>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323369
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4