[horde] Re: using DB function

Jan Schneider jan at horde.org
Sun Feb 27 04:48:06 PST 2005


Zitat von Craig White <craigwhite at azapple.com>:

> require_once 'DB.php';
>
> $_db = &DB::connect($conf['sql'], true);
>
> $query = sprintf('SELECT pref_value FROM horde_prefs WHERE pref_uid =
> "Administrator" and pref_scope = "horde" and
> pref_name="category_colors"');
>
> $result = $_db->query($query);
>
> $values = $this->$result;
>
> var_dump($result);
> ---
> and it results in connection error when I know that the $conf['sql']
> array is good. The top of the output is listed below.

And where is this connection error?

> # php test.php
> Content-type: text/html
> X-Powered-By: PHP/4.3.2
>
> NULL
> object(db_result)(9) {
>  ["dbh"]=>
>  &object(db_mysql)(25) {
>    ["connection"]=>
>    resource(6) of type (mysql link persistent)
>    ["phptype"]=>
>    string(5) "mysql"
>    ["dbsyntax"]=>
>    string(5) "mysql"
>    ["prepare_tokens"]=>
>    array(0) {
>    }
>    ["prepare_types"]=>
>    array(0) {
>    }
>    ["num_rows"]=>
>    array(1) {
>      [7]=>
>      int(1)
>    }
>    ["transaction_opcount"]=>
>    int(0)
>    ["autocommit"]=>
>    bool(true)
>    ["fetchmode"]=>
>    int(1)
>    ["_db"]=>
>    string(5) "horde"
>    ["_debug"]=>
>    bool(false)
>    ["_default_error_mode"]=>
>    NULL
>    ["_default_error_options"]=>
>    NULL
>    ["_default_error_handler"]=>
>    string(0) ""
>    ["_error_class"]=>
>    string(8) "DB_Error"
>    ["_expected_errors"]=>
>    array(0) {
>    }

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/


More information about the horde mailing list