Sprawdziłem ze problem powoduje metoda DB:conncet(), DB:isError() jest ok.
Pokazywanie błędów mam włączone. Jesli widzisz bład składni to powiedz w ktorym miejscu.
Co do var_dump() to sprawdzeniu metody connect otzymuje:
Przy wpisaniu var_dump(DB::connect())
Kod
Warning: Missing argument 1 for connect() in c:\usr\krasnal\www\sonda\Core\DB-1.7.6\DB.php on line 518
object(db_error)(8) { ["error_message_prefix"]=> string(0) "" ["mode"]=> int(1) ["level"]=> int(1024) ["code"]=> int(-4) ["message"]=> string(19) "DB Error: not found" ["userinfo"]=> string(41) "Unable to include the DB/.php file for ''" ["backtrace"]=> array(4) { [0]=> array(6) { ["file"]=> string(45) "c:\usr\krasnal\www\sonda\Core\DB-1.7.6\DB.php" ["line"]=> int(888) ["function"]=> string(10) "pear_error" ["class"]=> string(8) "db_error" ["type"]=> string(2) "->" ["args"]=> array(5) { [0]=> string(19) "DB Error: not found" [1]=> int(-4) [2]=> int(1) [3]=> int(1024) [4]=> string(41) "Unable to include the DB/.php file for ''" } } [1]=> array(6) { ["file"]=> string(58) "c:\usr\krasnal\www\sonda\Core\DB-1.7.6\PEAR-1.3.5\PEAR.php" ["line"]=> int(540) ["function"]=> string(8) "db_error" ["class"]=> string(8) "db_error" ["type"]=> string(2) "->" ["args"]=> array(4) { [0]=> int(-4) [1]=> int(1) [2]=> int(1024) [3]=> string(41) "Unable to include the DB/.php file for ''" } } [2]=> array(6) { ["file"]=> string(45) "c:\usr\krasnal\www\sonda\Core\DB-1.7.6\DB.php" ["line"]=> int(543) ["function"]=> string(10) "raiseerror" ["class"]=> string(4) "pear" ["type"]=> string(2) "::" ["args"]=> array(7) { [0]=> NULL [1]=> int(-4) [2]=> NULL [3]=> NULL [4]=> string(41) "Unable to include the DB/.php file for ''" [5]=> string(8) "DB_Error" [6]=> bool(true) } } [3]=> array(6) { ["file"]=> string(34) "c:\usr\krasnal\www\sonda\index.php" ["line"]=> int(10) ["function"]=> string(7) "connect" ["class"]=> string(2) "db" ["type"]=> string(2) "::" ["args"]=> array(0) { } } } ["callback"]=> NULL }
a przy wpisaniu var_dump(DB::connect($dns)) znow nie pokazuje sie nic.
Wiec być moze problem leży po stronie zmiennej $dns??
Zamieszczam wspomniana metod DB::connect() moze to w czyms pomoze:
<?php
function &connect
($dsn, $options = array()) {
$dsninfo = DB::parseDSN($dsn);
$type = $dsninfo['phptype'];
/*
* For backwards compatibility. $options used to be boolean,
* indicating whether the connection should be persistent.
*/
$options = array('persistent' => $options); }
if (isset($options['debug']) && $options['debug'] >= 2) { // expose php errors with sufficient debug level
include_once "DB/${type}.php";
} else {
@include_once "DB/${type}.php";
}
$classname = "DB_${type}";
if (!class_exists($classname)) {
$tmp = PEAR::raiseError(null, DB_ERROR_NOT_FOUND, null, null,
"Unable to include the DB/{$type}.php"
. " file for '$dsn'",
'DB_Error', true);
return $tmp;
}
@$obj =& new $classname;
foreach ($options as $option => $value) {
$test = $obj->setOption($option, $value);
if (DB::isError($test)) {
return $test;
}
}
$err = $obj->connect($dsninfo, $obj->getOption('persistent'));
if (DB::isError($err)) {
$err->addUserInfo($dsn);
return $err;
}
return $obj;
}
?>