ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:session:reference:adodb_sess_conn

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
v5:session:reference:adodb_sess_conn [2016/05/22 16:55] – created mnewnhamv5:session:reference:adodb_sess_conn [2021/01/23 22:53] (current) – [$ADODB_SESS_CONN] mnewnham
Line 1: Line 1:
 ====== $ADODB_SESS_CONN ====== ====== $ADODB_SESS_CONN ======
 This variable holds an instance of the database connection and can be used as required. The connection is itself an instance of a standard ADOdb connections, and all available functionality may be used. This variable holds an instance of the database connection and can be used as required. The connection is itself an instance of a standard ADOdb connections, and all available functionality may be used.
 +
 +The feature is also useful if you want session manager to use a connection that relies on complex connection parameters, such a MySQL SSL certificates (see the second example) which cannot be achieved using the normal session connection. This is done by telling the session manager to use an already instantiated connection.
 ===== Usage ===== ===== Usage =====
 <code php> <code php>
Line 27: Line 29:
 * etc etc etc...... * etc etc etc......
 */ */
 +</code>
 +
 +===== Using An Existing Connection =====
 +<code php>
 +
 +$dbtype="mysqli";
 +$dbhost="some.server";
 +$dbusername="some.user";
 +$dbpassword="some.password";
 +$dbname="some.db";
 +
 +$dbconn=NewADOConnection($dbtype);
 +$dbconn->ssl_capath="";
 +$dbconn->clientFlags=MYSQLI_CLIENT_SSL;
 +$dbconn->Connect($dbhost,$dbusername,$dbpassword,$dbname);
 +
 +$GLOBALS['ADODB_SESS_CONN'] = $dbconn;
 +
 +ADOdb_Session::config($dbtype, $dbhost, $dbusername, $dbpassword, $dbname, $options=false);
 +session_start();
 </code> </code>
v5/session/reference/adodb_sess_conn.1463928922.txt.gz · Last modified: 2017/04/21 11:38 (external edit)