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

Subscribe to our news:
Partners
Testimonials
Simon Greener: "A lot of work went in to designing our application database. PHP Generator allowed us to build a fully functional, professional looking, and functionally powerful web application from that database. It has freed us from worrying about low level code, enabling us to focus on the business requirements of the customer. The support provided is excellent with staff quickly producing answers to questions ranging from newbie to simple or complex. I highly recommend the product".
Roger Brown: "Great product. The more I work with it, the more I am amazed at what it can do".

More

Add your opinion

PostgreSQL PHP Generator 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