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".
Kirby Foster: "Nice software. Small, lightweight, works well. I evaluated lots of software before deciding that your software worked the best for what I do. Both Maestro for MySQL and PHP Generator have saved me lots of time".

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 in our Feature Demo to filter countries according to the values selected in the form:

 

// 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

} else if (isset($_SESSION['minLifeExpectancy']) && 

           isset($_SESSION['maxLifeExpectancy'])) {

    $minLifeExpectancy = $_SESSION['minLifeExpectancy'];

    $maxLifeExpectancy = $_SESSION['maxLifeExpectancy'];

}

 

// saving calculated values to the session

$_SESSION['minLifeExpectancy'] = $minLifeExpectancy;

$_SESSION['maxLifeExpectancy'] = $maxLifeExpectancy;

 

// applying filter to the dataset

$this->dataset->AddCustomCondition(

    "life_expectancy >= {$minLifeExpectancy} ".

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

 

See also: OnPreparePage.



Prev Return to chapter overview Next