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

validateDeleteWithFunction

Allows you to set logic allowing if deletion of certain rows is permissible or not
void validateDeleteWithFunction ( String functionName )
Use this function when you wish to use logic to determine if a row can be deleted or not. In other words - you can base the decision on data in OTHER fields in the row. As such, the user-defined function will have access to the id (primary key) of the row to make logic-based decision and must return TRUE or FALSE. The parameters of your custom function (which YOU define) must take in ONE (1) argument ($id) and return TRUE or FALSE.

Details

Requires a user-defined function to be set
Type function
Returns user-defined method returns true or false

Parameters

functionName
name of the user-defined function to be invoked

Example

Example:
   $tblUser->validateDeleteWithFunction("canRowBeModifiedOrDeleted");

   # this function returns true or false, depending 
   # on if his IP address matches the stored ip address 
   # for the user (i.e. very lame authentication)
   function canRowBeModifiedOrDeleted($id){
     $ip = q1("SELECT fldIPAddress FROM tblUser 
                          WHERE pkUserID = $id");

     if ($ip == $_SERVER["REMOTE_ADDR"])
        return true;

     return false;
   }

See also

New, Edit

 

"Sweet!!! One of the few packages that runs right out of the box. Just modify a couple of lines[s] [and] it runs perfectly."
~Mike

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