====== ADOdb_Session::config ======
~~NOTOC~~
==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:
- A connection to a database already used be ADOdb for read/write operations.
- A connection to a different database but in the same rdbms
- A connection entirely separate from an existing ADOdb connection
The method should be called **//before//** the PHP command [[http://php.net/manual/en/function.session-start.php|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';