public function connect($host, $user, $password, $database = '', $port = '', $socket = '', $connect = false) {

        // if the "memcache" extension is loaded and the caching method is set to "memcache"
        if (!extension_loaded('memcache') || $this->caching_method == 'memcache')

            // suppress the warning telling the developer to use memcache for caching query results
            unset($this->warnings['memcache']);

        // we are using lazy-connection
        // that is, we are not going to actually connect to the database until we execute the first query
        // the actual connection is done by the _connected method
        $this->credentials = array(
            'host'      => $host,
            'user'      => $user,
            'password'  => $password,
            'database'  => $database,
            'port'      => $port == '' ? ini_get('mysqli.default_port') : $port,
            'socket'    => $socket == '' ? ini_get('mysqli.default_socket') : $socket,
        );

        // connect now, if we need to connect right away
        if ($connect) $this->_connected();

    }
public function connect($host, $user, $password, $database = '', $port = '', $socket = '', $connect = false) {

        // if the "memcache" extension is loaded and the caching method is set to "memcache"
        if (!extension_loaded('memcache') || $this->caching_method == 'memcache')

            // suppress the warning telling the developer to use memcache for caching query results
            unset($this->warnings['memcache']);

        // we are using lazy-connection
        // that is, we are not going to actually connect to the database until we execute the first query
        // the actual connection is done by the _connected method
        $this->credentials = array(
            'host'      => $host,
            'user'      => $user,
            'password'  => $password,
            'database'  => $database,
            'port'      => $port == '' ? ini_get('mysqli.default_port') : $port,
            'socket'    => $socket == '' ? ini_get('mysqli.default_socket') : $socket,
        );

        // connect now, if we need to connect right away
        if ($connect) $this->_connected();

    }
public function connect ( $ host , $ user , $ password , $ database = '' , $ port = '' , $ socket = '' , $ connect = false ) { // if the "memcache" extension is loaded and the caching method is set to "memcache" if ( ! extension_loaded ( 'memcache' ) || $ this -> caching_method == 'memcache' ) // suppress the warning telling the developer to use memcache for caching query results unset ( $ this -> warnings [ 'memcache' ] ) ; // we are using lazy-connection // that is, we are not going to actually connect to the database until we execute the first query // the actual connection is done by the _connected method $ this -> credentials = array ( 'host' => $ host , 'user' => $ user , 'password' => $ password , 'database' => $ database , 'port' => $ port == '' ? ini_get ( 'mysqli.default_port' ) : $ port , 'socket' => $ socket == '' ? ini_get ( 'mysqli.default_socket' ) : $ socket , ) ; // connect now, if we need to connect right away if ( $ connect ) $ this -> _connected ( ) ; }
Opens a connection to a MySQL Server and optionally selects a database.

Since the library is using <i>lazy connection</i> (it is not actually connecting to the database until the first
query is executed), the object representing the connection to the MySQL server is not available at this time. If
you need it, use the {@link get_link()} method.

If you need the connection to the database to be made right away, set the <i>connect</i> argument to TRUE.

<code>
// create the database object
$db = new Zebra_Database();

// notice that we're not doing any error checking. errors will be shown in the debugging console
$db->connect('host', 'username', 'password', 'database');
</code>

@param  string  $host       The address of the MySQL server to connect to (i.e. localhost).

Prepending host by <b>p:</b> opens a persistent connection.

@param  string  $user       The user name used for authentication when connecting to the MySQL server.

@param  string  $password   The password used for authentication when connecting to the MySQL server.

@param  string  $database   (Optional) The database to be selected after the connection is established.

This can also be set later with the {@link select_database()} method.

@param  string  $port       (Optional) The port number to attempt to connect to the MySQL server.

Leave as empty string to use the default as returned by ini_get("mysqli.default_port").

@param  string  $socket     (Optional) The socket or named pipe that should be used.

Leave as empty string to use the default as returned by ini_get("mysqli.default_socket").

Specifying the socket parameter will not explicitly determine the type of connection
to be used when connecting to the MySQL server. How the connection is made to the MySQL
database is determined by the <i>host</i> argument.

@param  boolean $connect    (Optional) Setting this argument to TRUE will force the library to connect to the
database right away instead of using a "lazy connection" where the actual connection
to the database will be made when the first query is run.

Default is FALSE.

@return void
Opens a connection to a MySQL Server and optionally selects a database .