Choose your database:
AnySQL
MySQL
MS SQL Server
PostgreSQL
SQLite
Firebird
Oracle
SQL Anywhere
DB2
MaxDB

Subscribe to our news:
Partners
Testimonials
Olivier Auverlot: "At my work (a universitary computer research laboratory), I'm alone to create all applications and databases. I don't know how I could do all the work without it. It's really a very productive software. I can focus on the database schemas and create quickly the user applications with a minimal amount of code to maintain".
Simon Greener: "A lot of work went in to designing our application database. PHP Generator allowed us to build a fully functional, professional looking, and functionally powerful web application from that database. It has freed us from worrying about low level code, enabling us to focus on the business requirements of the customer. The support provided is excellent with staff quickly producing answers to questions ranging from newbie to simple or complex. I highly recommend the product".

More

Add your opinion

PostgreSQL PHP Generator online Help

Prev Return to chapter overview Next

OnAfterDeleteRecord

This event occurs when the Delete command is executed, and after the actual deletion.

 

Signature:

function OnAfterDeleteRecord ($page, $rowData, $tableName,

       &$success, &$message, &$messageDisplayTime)

 

Parameters:

$page

An instance of the Page class.

$rowData

The associative array of values that corresponds to the currently processed row.

$tableName

The name of processed table.

$success

Indicates whether the last data manipulation statement was successful or not.

$message

A message to be displayed to a user. If the statement completed successfully, the value of this parameter is equal to empty string. If the statement failed, the value of this parameter contains the error message that came from the database server.

$messageDisplayTime

A time interval (in seconds) after which the message will disappear automatically. Default value is 0 (the message will not disappear).

 

Success messages are displayed in green while error messages are displayed in red.

 

Example 1:

The following code shows the message about a success of the operation. The message will be hidden in 5 seconds:

 

if ($success) {

  $message = 'Record processed successfully.';

}

else {

  $message = '<p>Something wrong happened. ' .

    '<a class="alert-link" href="mailto:admin@example.com">' .

      'Contact developers</a> for more info.</p>';

}

$messageDisplayTime = 5;

 

Example 2:

The following code logs information about deleted records in a separate table:

 

if ($success) {

  $userId = $page->GetCurrentUserId();    

  $currentDateTime = SMDateTime::Now();

  $sql = 

    "INSERT INTO activity_log (table_name, action, user_id, log_time) " .

    "VALUES ('$tableName', 'DELETE', $userId, '$currentDateTime');";

  $page->GetConnection()->ExecSQL(sprintf($sql, $userId, $action, $currentDateTime));

}

 

See also: OnAfterUpdateRecord, OnAfterInsertRecord, OnBeforeDeleteRecord.



Prev Return to chapter overview Next