From c7cd62a0d06f7ea979a598234a7b17b74c0099d1 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 20 Dec 2006 01:20:15 +0000 Subject: [PATCH] Resolving more issues with DB connection --- Db.php | 10 ++++++++-- DbMySql.php | 14 ++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Db.php b/Db.php index d8d1d14..e38e636 100644 --- a/Db.php +++ b/Db.php @@ -474,12 +474,18 @@ abstract class BSDb { if ($this->showerrors) { + if ($this->dblink) + { + $this->errnum = $this->_errorNumber(); + $this->errstr = $this->_errorString(); + } + $style['code'] = 'font-family: \'Courier New\', Courier, mono; font-size: 11px;'; $message_prepped = "
\n

"; $message_prepped .= "\n\t» Query:\n

" . htmlspecialchars($this->querystr) ."
\n
"; - $message_prepped .= "\n\t» Error Number: " . $this->_errorNumber() . "\n
"; - $message_prepped .= "\n\t» Error Message: " . $this->_errorString() . "\n
"; + $message_prepped .= "\n\t» Error Number: " . $this->errnum . "\n
"; + $message_prepped .= "\n\t» Error Message: " . $this->errstr . "\n
"; $message_prepped .= "\n\t» Additional Notes: " . $message . "\n
"; $message_prepped .= "\n\t» File: " . $_SERVER['PHP_SELF'] . "\n"; $message_prepped .= "\n

\n
"; diff --git a/DbMySql.php b/DbMySql.php index 2f3527a..ce91c9b 100644 --- a/DbMySql.php +++ b/DbMySql.php @@ -47,8 +47,11 @@ class BSDbMySql extends BSDb */ protected function _connect($server, $user, $password, $database) { - $link = mysql_connect($server, $user, $password); - $this->_selectDb($database, $link); + $link = @mysql_connect($server, $user, $password); + if ($link) + { + $this->_selectDb($database, $link); + } return $link; } @@ -59,8 +62,11 @@ class BSDbMySql extends BSDb */ protected function _pConnect($server, $user, $password, $database) { - $link = mysql_pconnect($server, $user, $password); - $this->_selectDb($database, $link); + $link = @mysql_pconnect($server, $user, $password); + if ($link) + { + $this->_selectDb($database, $link); + } return $link; } -- 2.43.5