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

Subscribe to our news:
Partners
Testimonials
Craig Cordell: "The simplicity of your code generator is fantastic. We've evaluated dozens of others over the past few years but have yet to find one that is as easy to use as yours".
Rickey Steinke: "Folks, I wanted to drop a line and give you a fanatic thank you. I have a project due for my computer application course and without PHP Generator I never would have gotten it done with the professional results your product produced. My sincerest gratitude to each and every team member who brought this program to light".

More

Add your opinion

PHP Generator for MySQL online Help

Prev Return to chapter overview Next

OnBeforeInsertRecord

This event occurs when the Insert command is executed, and before the actual insertion.

 

Signature:

function OnBeforeInsertRecord ($page, &$rowData, &$cancel, &$message, 

       &$messageDisplayTime, $tableName)

 

Parameters:

$page

An instance of the Page class declared in components/page.php.

$rowData

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

$cancel

The value indicating whether the operation should be canceled.

$message

The message string that is displayed after the operation is completed (or canceled).

$messageDisplayTime

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

$tableName

The name of processed table.

 

Example 1:

if (!(allowDataEditing())) {

  $cancel = true;

  $message = 'The application is running in read-only mode.';

}

 

Example 2:

The following code allows to assign values to some fields (usually these fields are not included in an insert form)

before inserting of a record:

 

$rowData['line_total'] = $rowData['quantity'] * $rowData['unit_price'];

$rowData['create_datetime'] = SMDateTime::Now();

$rowData['insert_by'] = $page->GetCurrentUserId();    

 

See also: OnBeforeUpdateRecord, OnBeforeDeleteRecord, OnAfterInsertRecord.



Prev Return to chapter overview Next