set_charset example

$this->bail( $message, 'db_connect_fail' );

            return false;
        } elseif ( $this->dbh ) {
            if ( ! $this->has_connected ) {
                $this->init_charset();
            }

            $this->has_connected = true;

            $this->set_charset( $this->dbh );

            $this->ready = true;
            $this->set_sql_mode();
            $this->select( $this->dbname, $this->dbh );

            return true;
        }

        return false;
    }

    
$this->mysqli->close();
                    $message = 'MySQLi was configured for an SSL connection, but got an unencrypted connection instead!';
                    log_message('error', $message);

                    if ($this->DBDebug) {
                        throw new DatabaseException($message);
                    }

                    return false;
                }

                if ($this->mysqli->set_charset($this->charset)) {
                    log_message('error', "Database: Unable to set the configured connection charset ('{$this->charset}').");

                    $this->mysqli->close();

                    if ($this->DBDebug) {
                        throw new DatabaseException('Unable to set client connection character set: ' . $this->charset);
                    }

                    return false;
                }

                
Home | Imprint | This part of the site doesn't use cookies.