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

Subscribe to our news:
Partners
Testimonials
Lucian Nedescu: "Thank you very much. Have a nice century (this is a real wish :P). I think that i will do a great job on my clients database with the new php interface. Thank You again".
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

Session methods

The following methods can be used to handle session variables.

 

Signature

Description

IsSessionVariableSet($name)

Checks if the given variable exists in the session.

GetSessionVariable($name)

Returns the value of the given session variable.

SetSessionVariable($name, $value)

Sets a value to a session variable.

UnSetSessionVariable($name)

Removes the given variable from the session.

 

The code in the examples below is used in the OnPreparePage event handler:

 

Example 1:

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);

 

Example 2:

The code below removes the 'minLifeExpectancy' and 'maxLifeExpectancy' variables from the session if the 'resetLifeExpectancyFilter' variable is specified in $_GET.

 

if (GetApplication()->IsGetValueSet('resetLifeExpectancyFilter')) {

  GetApplication()->UnSetSessionVariable('minLifeExpectancy');

  GetApplication()->UnSetSessionVariable('maxLifeExpectancy');

}

 



Prev Return to chapter overview Next