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

Subscribe to our news:
Partners
Testimonials
Johnson Sieu: "Your PHP Generator is the BEST that I have used so far. It is affordable and user-friendly. Congratulation for coming up with such a fine product. I will not hesitate to introduce it to my peers".
Svetlio Mitev: "I am really sure that you guys can make the best PHP code generators to be found worldwide".

More

Add your opinion

SQLite 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