» a PHP class to Create, Read, Update, & Delete from a mysql database table using AJAX

   by loud canvas media

AjaxCRUD Class Documentation / Reference Material

<< Reference overview
<< Home


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.


Requires a user-defined function to be set
Type function
Returns formatted data
Default non-formatted data


name of the field you want to format
name of the local function to be invoked


Example 1:
   $tblDemo->formatFieldWithFunction('fldCarPrice', 'formatAsCurrency');
   function formatAsCurrency($data){
        return number_format($data, 2, '.', ','); //displays 10 as 10.00

Example 2:
    $tblDemo = formatFieldWithFunction("fldImage", "displayImage");
    function displayImage($value){
    	 //displays the image instead of just the filename
         return "<img src='/images/{$value}' width='100' \>\n";

See also

New, Edit


"wow. that`s all I can say. Wow. I wish I had found this .... years ago.."

What is a business/commercial website?

A commercial website is one created for a business, for which purpose is generating revenue or cash flow of any type (and that isn't under a non-profit organization). So if you're selling a product, selling advertisement, selling a service, or just marketing a commercial business, your site is commercial. A company website is also commercial even if it doesn't sell anything, as it's purpose is to front a commercial company.