[horde] using DB function
Craig White
craigwhite at azapple.com
Fri Feb 25 17:47:09 PST 2005
trying to test a theory and I didn't have these kind of problems
creating connection to ldap so it's apparent to me that I am not getting
the methodology of using DB to connect to mysql...
I have this simple program...
---
<?php
$conf['sql']['phptype'] = 'mysql';
$conf['sql']['persistent'] = false;
$conf['sql']['socket'] = '/var/lib/mysql/mysql.sock';
$conf['sql']['protocol'] = 'unix';
$conf['sql']['hostspec'] = 'localhost';
$conf['sql']['username'] = 'horde';
$conf['sql']['password'] = '****';
$conf['sql']['database'] = 'horde';
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.
What am I missing in this program?
Thanks
Craig
# 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) {
}
More information about the horde
mailing list