ajaxCRUD.com

» 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

onAddExecuteCallBackFunction

calls a local function when a new row is added
void onAddExecuteCallBackFunction ( String functionName )

use this function when you want to apply certain logic (or display a certain message) when a new row is added. Use of this function is similar in a way to a java interface: you must define a function with the name specified in the function call.

The defined function must take ONE parameter (an array). The indexes of this array are the fields of the table. (with one extra index: "id")

NOTE: this function will TURN OFF ajax adding.

NB: if you wish to implement logic which will require headers not be sent prior (e.g. set cookies or header redirects) you will need to set the variable doActionOnShowTable to FALSE and then direct your executing script to call obj->doAction("add").

Details

Requires (callback function)
Type function
Returns void

Parameters

functionName
name of the local, user-defined function to be invoked when a row is added

Example

$demo->onAddExecuteCallBackFunction("doMyLogicForAdding");

//down below the showTable() function
function doMyLogicForAdding($array){
  $pkMenuID = $array['pkMenuID'];//indexes are fields from db
  $filename   = $array['fldFilename'];

  //update this table (or some other table)
  if ($fldURL == ''){
    $success = qr("UPDATE tblMenu SET fldURL = \"$filename\"
                              WHERE pkMenuID = $pkMenuID");
  }
}

See also

New, Edit

 

"Thanks for the great script, you rock big time."
~Daniel

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.
Close