summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/database.mysql.inc11
1 files changed, 9 insertions, 2 deletions
diff --git a/includes/database.mysql.inc b/includes/database.mysql.inc
index 20edf814a..5fb934328 100644
--- a/includes/database.mysql.inc
+++ b/includes/database.mysql.inc
@@ -28,7 +28,14 @@ function db_connect($url) {
$url['host'] = $url['host'] .':'. $url['port'];
}
- $connection = mysql_connect($url['host'], $url['user'], $url['pass'], TRUE) or die(mysql_error());
+ // - TRUE makes mysql_connect() always open a new link, even if
+ // mysql_connect() was called before with the same parameters.
+ // This is important if you are using two databases on the same
+ // server.
+ // - 2 means CLIENT_FOUND_ROWS: return the number of found
+ // (matched) rows, not the number of affected rows.
+ $connection = mysql_connect($url['host'], $url['user'], $url['pass'], TRUE, 2) or die(mysql_error());
+
mysql_select_db(substr($url['path'], 1)) or die('unable to select database');
return $connection;
@@ -239,4 +246,4 @@ function db_escape_string($text) {
* @} End of "ingroup database".
*/
-?> \ No newline at end of file
+?>