bueno como casi siempre me autocontesto:
http://peardoc.m-takagi.org/en/packa...db2-error.html
Example 33-1. Trapping errors and determining what happened
Código PHP:
<?php
require_once 'MDB2.php';
$mdb2 =& MDB2::connect('pgsql://wronguser:badpw@localhost/thedb');
if (PEAR::isError($mdb2)) {
/*
* This is not what you would really want to do in
* your program. It merely demonstrates what kinds
* of data you can get back from error objects.
*/
echo 'Standard Message: ' . $mdb2->getMessage() . "\n";
echo 'Standard Code: ' . $mdb2->getCode() . "\n";
echo 'DBMS/User Message: ' . $mdb2->getUserInfo() . "\n";
echo 'DBMS/Debug Message: ' . $mdb2->getDebugInfo() . "\n";
exit;
}
?>
Example 33-2. Error handling during development/debugging.
Código PHP:
<?php
require_once 'MDB2.php';
$mdb2 =& MDB2::connect('pgsql://wronguser:badpw@localhost/thedb');
if (PEAR::isError($mdb2)) {
die($mdb2->getMessage() . $mdb2->getDebugInfo());
}
?>