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

Subscribe to our news:
Partners
Testimonials
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".
Patrick Biegel: "Thanks a lot for your fast reply and the great solution! It works now and that's really important! The PHP Generator for MySQL is a great software".

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