This is not exactly a coldbox related question, but I am using the
cfscript query stuff,
// Get Entries List
result function getEntries()
{
var query = new Query(datasource="mps", sql="SELECT title,contents
FROM blogs");
var oResults = query.execute();
return oResults;
}
And was wondering what the best way to do loops of queries is now.
Cleary, the object passed back now from query.execute() is a result. I
have tried
<cfloop query="rc.entries.getResult()">
</cfloop>
With no success...
This works here:
var oResults = query.execute();
var numRes = oResults.getPrefix().recordcount;
var qResults = oResults.getResult();
for(var i = 1; i <= numRes; i++)
{
WriteOutput(query["title"][i]);
WriteOutput(query["contents"][i]);
}
But is that the best way of doing things now?