Created
October 19, 2018 16:35
-
-
Save trycf/f24e7fd022c323846ba045af244472d7 to your computer and use it in GitHub Desktop.
TryCF Gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
// Define our query | |
platform = ["Adobe ColdFusion", "Railo", "Lucee"]; | |
myQuery = queryNew(" "); | |
queryAddColumn(myQuery, "platform", "CF_SQL_VARCHAR", platform); | |
// By row index | |
writeOutput("<h3>By row:</h3>"); | |
for (i = 1; i <= myQuery.recordCount; i++) { | |
writeOutput("<li>#myQuery["platform"][i]#</li>"); | |
} | |
// By query | |
writeOutput("<h3>By query:</h3>"); | |
for (row in myQuery) { | |
writeOutput("<li>#row.platform#</li>"); | |
} | |
// By arrayeach | |
writeOutput("<h3>By arrayeach:</h3>"); | |
function printArray(vendor, index) | |
{ | |
writeOutput("<li>#vendor#</li>"); | |
} | |
arrayEach(platform,printArray); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment