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

Subscribe to our news:
Partners
Testimonials
Steve Morton: "First let me thank you for making this application Free. Best deal I have ever see for what it does".
Charles Phillips: "Just want to take a second to really thank you for all the great support you give – I think that’s by far the best feature you offer".

More

Add your opinion

PHP Generator for MySQL online Help

Prev Return to chapter overview Next

Using Variables

PHP Generator for MySQL supports:

some environment variables (such as CURRENT_USER_ID, CURRENT_USER_NAME, UNIQUE_ID) in both page and application level server-side events.
custom environment variables to be used in any server-side event of the concrete page (specified within the OnAddEnvironmentVariables event handler) and in any server-side event of any application page (specified within the global OnAddEnvironmentVariables event handler). Such variables can also be used in lookup filter criteria, on data filtering, and as default values.

 

Retrieving the list of available variables

To obtain a complete list of supported variables, turn ON the "Show environment variables" option in the Project Options dialog, re-generate the code and then open any of produced web pages in the browser.

 

 

Accessing variable value

To access the value of a variable, use the GetEnvVar method of the Page class.

 

Example 1

The following example demonstrates how to use variables within the OnBeforeInsertRecord event handler.

 

$rowData['ip_address'] = $page->GetEnvVar('REMOTE_ADDR');

$userName = $page->GetEnvVar('CURRENT_USER_NAME');

if ($userName != 'admin')

    $rowData['changed_by'] = $userName;

 

Within server-side page-level events it is also possible to use $this instead of $page.

 

Example 2

The following code used in the OnAddEnvironmentVariables event handler defines a new variable, which can be used in lookup filter criteria, on data filtering, as a default value, and also in any server-side event.

 



Prev Return to chapter overview Next