Posts

Showing posts with the label coldfusion query results in commas

How to display comma separated query column values in coldfusion

 Suppose if you have a query which returns some names of person. For example, if you have a table called person which have a column called fist_name and last_name. if you have to display each first_name and last_name comma separated you can use the following code. We can have the query like this: <cfquery name="getperson" datasource="datasourcename">     select first_name,last_name from person </cfquery> so for displaying this result , we can have a code like this: <cfoutput query="#getperson#">      #trim(getperson.first_name)# #trim(getperson.last_name)#<cfif                getperson.currentrow LT getperson.recordCount>, </cfif>  </cfoutput>