Saving an array to a string? ColdFusion.

I am wondering if this is possible?
I would like to query a db:
Select color,car,age

FROM this table

color            car              age
blue           family             1
green         sport               2
red             van                 3



I want to output the results of the query as:
<cfset string="[blue,family,1] , [green,sport,2] , [red.van,3]">


 is this possible?

I have tried many ways, all are either outputting only a single row,  or trying to use ValueList()  i am returning :
 [blue,red,green] [family, sport,van] [1,2,3]...

Thanks!!!
izweigAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
gdemariaConnect With a Mentor Commented:
Sure, you can format a string to look anyway you want it to look.

<cfset str = "">
<cfoutput query="myQuery">
   <cfset str = listAppend(str," [#myQuery.color#,#car#,#age#] ")>
</cfoutput>

<cfoutput>#str#</cfoutput>
0
 
izweigAuthor Commented:
Thank you, exactly what I was looking for! Soo easy when you know how!
0
All Courses

From novice to tech pro — start learning today.