--- includes/database.mysql.inc	2005-08-14 05:58:26.000000000 -0400
+++ ../../Patches/database.mysql.inc	2005-11-25 16:09:35.000000000 -0500
@@ -28,7 +28,7 @@
      $url['host'] = $url['host'] .':'. $url['port'];
   }
 
-  $connection = mysql_connect($url['host'], $url['user'], $url['pass'], TRUE) or die(mysql_error());
+  $connection = mysql_connect($url['host'], $url['user'], $url['pass'], TRUE) or die(mysql_error($connection));
   mysql_select_db(substr($url['path'], 1)) or die('unable to select database');
 
   return $connection;
@@ -56,14 +56,14 @@
   }
 
   if ($debug) {
-    print '<p>query: '. $query .'<br />error:'. mysql_error() .'</p>';
+    print '<p>query: '. $query .'<br />error:'. mysql_error($active_db) .'</p>';
   }
 
-  if (!mysql_errno()) {
+  if (!mysql_errno($active_db)) {
     return $result;
   }
   else {
-    trigger_error(mysql_error() ."\nquery: ". htmlspecialchars($query), E_USER_ERROR);
+    trigger_error(mysql_error($active_db) ."\nquery: ". htmlspecialchars($query), E_USER_ERROR);
     return FALSE;
   }
 }
@@ -136,7 +136,8 @@
  * Determine whether the previous query caused an error.
  */
 function db_error() {
-  return mysql_errno();
+  global $active_db;
+  return mysql_errno($active_db);
 }
 
 /**
@@ -161,7 +162,8 @@
  * Determine the number of rows changed by the preceding query.
  */
 function db_affected_rows() {
-  return mysql_affected_rows();
+  global $active_db;
+  return mysql_affected_rows($active_db);
 }
 
 /**
@@ -240,4 +242,4 @@
  * @} End of "ingroup database".
  */
 
-?>
\ No newline at end of file
+?>
