ajaxCRUD.com

» a PHP class to create / read / update / delete from a database table using AJAX

   by loud canvas media

AjaxCRUD API Reference

<< Reference overview
<< Home

formatFieldWithFunction

format data in a column with a custom function
void formatFieldWithFunction( String fieldName, String functionName )
Use this function when you wish to format data in your table with a custom function. For example, you'd use this if you wanted to format money to always display looking like a currency.

The parameters of your custom function (which YOU define) must take in ONE argument ($data) and return your formated data.

Details

Type function
Returns formatted data
Default non-formated data

Parameters

fieldName
name of the name you want to format
functionName
name of the local function to be invoked when a file is uploaded

Example

$tblDemo->formatFieldWithFunction('fldCarPrice', 'formatAsCurrency');

function formatAsCurrency($data){
    return number_format($data, 2, '.', ',');
}

See also

New, Edit

 

"Very interesting class. Thanks a lot."
~gustavo