Просмотр поста

.
Screamer

~XeOn~, Для обработки ошибок
На словах я плохо объясняю лучше как обычно пример оставлю:

class Db extends mysqli
{

    /**
     * Construct
     *
     * Get connection parameters. Connect to mysql server. Setup connection charset
     * Description of connection parameters:
     * [host]     (string) hostname
     * [user]     (string) username
     * [password] (string) password
     * [db]       (string) database
     * [charset]  (string) charset
     *
     * @param (object) $conf Connection parameters
     * @throws Base_Exception If connection failed
     * @return (void)
     */
    public function __construct($conf)
    {

        $host = isset($conf->host) ? $conf->host : 'localhost';
        $user = isset($conf->user) ? $conf->user : 'root';
        $password = isset($conf->password) ? $conf->password : '';
        $db = isset($conf->db) ? $conf->db : 'test';
        $charset = isset($conf->charset) ? $conf->charset : 'utf8';

        try {
            parent::__construct($host, $user, $password, $db);
        } catch (Exception $e) {
            throw new Base_Exception($e, __CLASS__);
        }

        /* Setup charset */
        $this->query("SET NAMES " . $charset);

    }
}

Так же можно заюзать и без throw Для этого в блоке catch (Exception $e) можно написать например echo $e->getMessage();
Методы класса Exception можно посмотреть в документации по PHP