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

Subscribe to our news:
Partners
Testimonials
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".
Ananda Theerthan J: "I have been looking for PHP generator for years and now I am happy that I found one. Yes, its the PHP generator for MySQL. I completely rate 10/10 for this product for making life easier. It has lot of features and capabilities especially the CRUD, lookups and data partitioning. I love this product and recommend to others".

More

Add your opinion

PHP Generator for MySQL online Help

Prev Return to chapter overview Next

OnPageLoaded

This event occurs after the page is completely loaded from the server. It allows you, for example, to add additional filters to the dataset.

 

Signature:

function OnPageLoaded()

 

Parameters:

This method has no parameters.

 

Example 1

The following code is used in our Schema Browser Demo to filter database objects belonging to the selected database:

 

applyDatasetFilter($this->dataset);

 

Here applyDatasetFilter() is a function defined in the schema_browser_utils.php file as follows:

 

function applyDatasetFilter(Dataset $dataset) {

    if (GetApplication()->IsGETValueSet('database'))

        $value = GetApplication()->GetGETValue('database');

    else

        $value = ArrayUtils::GetArrayValueDef($_COOKIE, 'database');

    if (StringUtils::IsNullOrEmpty($value)) {

        $globalConnectionOptions = GetGlobalConnectionOptions();

        $value = $globalConnectionOptions['database'];

    }

    if (!StringUtils::IsNullOrEmpty($value)) {

        $dataset->AddFieldFilter('Database_name', new FieldFilter($value, '='));

        setcookie('database', $value);

    }

}

 

Example 2

The following code is used to filter countries by life expectancy:

 

// default values

$minLifeExpectancy = 40;

$maxLifeExpectancy = 90;

 

// checking values in the browser address line 

if (GetApplication()->isGetValueSet('minLifeExpectancy') &&

       GetApplication()->isGetValueSet('maxLifeExpectancy')) {

    $minLifeExpectancy = GetApplication()->GetGETValue('minLifeExpectancy');

    $maxLifeExpectancy = GetApplication()->GetGETValue('maxLifeExpectancy');

 

}  // or (if not found) in the session

elseif (GetApplication()->IsSessionVariableSet('minLifeExpectancy') && 

          GetApplication()->IsSessionVariableSet('maxLifeExpectancy')) {

    $minLifeExpectancy = GetApplication()->GetSessionVariable('minLifeExpectancy');

    $maxLifeExpectancy = GetApplication()->GetSessionVariable('maxLifeExpectancy');

}

 

// applying filter to the dataset

$this->dataset->AddCustomCondition(

    "life_expectancy >= {$minLifeExpectancy} ".

    "AND life_expectancy <= {$maxLifeExpectancy}");

 

// saving calculated values to the session

GetApplication()->SetSessionVariable('minLifeExpectancy', $minLifeExpectancy);

GetApplication()->SetSessionVariable('maxLifeExpectancy', $maxLifeExpectancy);

 

See also: OnPreparePage.



Prev Return to chapter overview Next