title: how to modify the results of a MySQL query in Coldfusion (replace database integer with HTML button/text)
body: <p>I'm using datatables along with Jquery Mobile (server Coldfusion8, MySQL 5.0.88) to display tabular data. While this works fine, I'm trying to integrate AJAX into the table, so whenever the user pages or filters, the database is queried again and updated.</p>
  
  <p>Right now I'm trying to get it to work using this <a href="http://www.jonathonjoyce.co.uk/2011/12/07/using-coldfusion-cfcs-to-return-data-to-datatables-1-8-2/" rel="nofollow">snippet</a></p>
  
  <pre><code>var userTable = $('#users).dataTable({
      "sAjaxSource": "path/to/handler.cfc?method=GetUsers",
      "aoColumns": [
          { "mDataProp": "id" , "sTitle": "ID"},
          { "mDataProp": "name" , "sTitle": "Name"},
          { "mDataProp": "surname" , "sTitle": "Surname"},
          { "mDataProp": "email" , "sTitle": "Email Address"}
        ]
      });
  </code></pre>
  
  <p>and inside CF:</p>
  
  <pre><code>&lt;cffunction name="GetUsers" access="remote" output="false" returntype="any" returnformat="json"&gt; 
      &lt;cfquery name="local.qryUsers" datasource="dsn"&gt;
        SELECT id, name, surname, email FROM tblUsers
      &lt;/cfquery&gt;
  
      &lt;cfscript&gt;
        local.strData = StructNew();
        local.strData['aaData'] = QueryToArray(local.qryCandidates);
        return local.strData;
       &lt;/cfscript&gt;
  
  &lt;/cffunction&gt;
  </code></pre>
  
  <p>My problem is I need to modfiy some data from the query, for example I'm storing a column named <em>status</em> with values 1,2,3,4,5 and when I'm building the query results, I'm replacing the status number with the correct text in the correct language. Or I have a Jquery Mobile edit/delete controlgroup in every row, which I don't have in the database.</p>
  
  <p><strong>Question</strong>:<br>
  Is there a way to add this to the query result returned from MySQL to Coldfusion = how can I (a) modifiy query results by looping over a column and replacing a number with some text (status) and (b) how can I add a full column to a query result (edit/delete) button, so I can then feed the whole thing into the AJAX response?</p>
  
  <p>Thanks for help!</p>