cfscript - get query result output
cfscriptQuery.cfm
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfscript tag: How to get query result output in cfscript</title>
</head>
<body>
<h2 style="color:DodgerBlue; font-style:italic">cfscript example: Query Output</h2>
<hr width="350" align="left" color="PaleVioletRed" />
<cfquery name="qEmployee" datasource="cfdocexamples">
SELECT Emp_ID, FirstName, LastName FROM Employees
</cfquery>
<h3 style="color:RosyBrown; font-style:italic;">
<u>Employee List</u>
<br />
<cfscript>
for(Counter=1; Counter LTE qEmployee.RecordCount; Counter++)
{
WriteOutput(qEmployee.Emp_ID[Counter]);
WriteOutput(" : ");
WriteOutput(qEmployee.FirstName[Counter]);
WriteOutput(" ");
WriteOutput(qEmployee.LastName[Counter]);
WriteOutput("<br />");
}
</cfscript>
</h3>
</body>
</html>