Question

How do I export the results of a coldfusion10 query to html? The user is currently uploading an excel sheet with dogs and I need to output the results of the pitBullcheck query to a html table to show the rows that have pitbulls in them. Breed is a column in the excel sheet.

<cffunction name="validateExcelSheet" access="public" output="yes" returnType="void" 
hint="check dogs">

    <cfspreadsheet
    action="read"
    src="#SESSION.theFile#"
    headerrow= "1"
    excludeHeaderRow = "true"
    query = "allData"
    rows = "1-#lastRow#" />


<cfscript>    
 pitBullcheck = new Query(
        sql ="SELECT * FROM allData where breed like 'Pit' ",
        dbtype = "query",
        allData = allData);
        pitBullresult = pitBullcheck.execute().getResult();
   </cfscript>

</cffunction>
Was it helpful?

Solution

<table>
<tr>
  <td>breed</td>
</tr>
<cfoutput query="pitBullresult">
  <tr>
    <td>#pitBullresult.breed#</td>
  </tr>
</cfoutput>
</table>

Then just add additional <td> for each column in your query.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top