ezSQL_mysqli::connect PHP Method

connect() public method

******************************************************************** Try to connect to mySQL database server
public connect ( $dbuser = '', $dbpassword = '', $dbhost = 'localhost', $dbport = false )
    function connect($dbuser = '', $dbpassword = '', $dbhost = 'localhost', $dbport = false)
    {
        global $ezsql_mysqli_str;
        $return_val = false;
        // Keep track of how long the DB takes to connect
        $this->timer_start('db_connect_time');
        // If port not specified (new connection issued), get it
        if (!$dbport) {
            list($dbhost, $dbport) = $this->get_host_port($dbhost, 3306);
        }
        // Must have a user and a password
        if (!$dbuser) {
            $this->register_error($ezsql_mysqli_str[1] . ' in ' . __FILE__ . ' on line ' . __LINE__);
            $this->show_errors ? trigger_error($ezsql_mysqli_str[1], E_USER_WARNING) : null;
        } else {
            $this->dbh = new mysqli($dbhost, $dbuser, $dbpassword, '', $dbport);
            // Check for connection problem
            if ($this->dbh->connect_errno) {
                $this->register_error($ezsql_mysqli_str[2] . ' in ' . __FILE__ . ' on line ' . __LINE__);
                $this->show_errors ? trigger_error($ezsql_mysqli_str[2], E_USER_WARNING) : null;
            } else {
                $this->dbuser = $dbuser;
                $this->dbpassword = $dbpassword;
                $this->dbhost = $dbhost;
                $this->dbport = $dbport;
                $return_val = true;
                $this->conn_queries = 0;
            }
        }
        return $return_val;
    }