diff --git a/includes/database.inc b/includes/database.inc
index fa2d6d2ad5aba3e134bee23bccd697a40bb7d4d2..c7903ef16d55eee66a5f8f88dc6645977314d61b 100644
--- a/includes/database.inc
+++ b/includes/database.inc
@@ -132,7 +132,7 @@ function db_set_active($name = 'default') {
   // Set the active connection.
   $active_db = $db_conns[$name];
 
-  return array_search($previousdb, $db_conns);
+  return array_search($previous_db, $db_conns);
 }
 
 /**