Ask Ben: Query Loop Inside CFScript Tags

<cfscript>
	 
	// Loop over the records in the query.
	for (
		intRow = 1 ; 
		intRow LTE qPornStars.RecordCount ; 
		intRow = (intRow + 1)
		){
		 
		// Output the name some values. When doing so, access the
		// query as if it were a structure of arrays and we want
		// only get values from this row index.
		WriteOutput(
			qPornStars[ "name" ][ intRow ] & " is a " &
			qPornStars[ "sex" ][ intRow ] & " that prefers doing " &
			qPornStars[ "preferred_category" ][ intRow ] & " movies." &
			"<br />" 
			);
	}
 
</cfscript>

For Cut-and-Paste