ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:session:reference:config

ADOdb_Session::config

Syntax
bool ADOdb_Session::config(
  string $driver, 
  optional string $host, 
  optional string $user, 
  optional string $password, 
  optional string $database,
  optional array $options
  )

Introduction

The static method config defines the parameters required to establish a connection to a database to store session data. The connection established can be either:

  1. A connection to a database already used be ADOdb for read/write operations.
  2. A connection to a different database but in the same rdbms
  3. A connection entirely separate from an existing ADOdb connection

The method should be called before the PHP command session_start. It must be defined in every procedure that accesses session variables.

Parameters

$driver

The ADOdb driver to be used when establishing the connection, or optionally a DSN style configuration string with all of the necessary information required to establish a connection

$host

The host name to use

$user

The user name to use

$password

The password to use

$database

The database to connect to

$options

An optional array of configuration parameters. A list of parameters is defined here.

Usage

include_once 'adodb/adodb.inc.php';
include_once "adodb/session/adodb-session2.php";
 
$driver = 'mysqli';
$host = '127.0.0.1';
$user = 'user';
$pass = 'pass';
$database = 'adodb-sess';
 
ADODB_Session::config($driver,$host,$user,$pass,$database);
 
session_start();
 
$_SESSION['page'] = 'page1';
v5/session/reference/config.txt · Last modified: 2018/07/01 21:53 by peterdd