Cleanup PR #2719

for Fix #2406 query builder cache

Signed-off-by: GDmac <grdalenoort@gmail.com>
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 0d04213..fb8514f 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -2557,22 +2557,19 @@
 			return;
 		}
 
-		$parts = array_unique($this->qb_cache_exists); // select, from, etc.
-
-		foreach ($parts as $val)
+		foreach (array_unique($this->qb_cache_exists) as $val) // select, from, etc.
 		{
 			$qb_variable	= 'qb_'.$val;
 			$qb_cache_var	= 'qb_cache_'.$val;
 
 			$qb_new = $this->$qb_cache_var;
 
-			foreach ($this->$qb_variable as $qb_var)
+			foreach ($this->$qb_variable as &$qb_var)
 			{
 			 	in_array($qb_var, $qb_new, TRUE) OR $qb_new[] = $qb_var;
 			}
 			
 			$this->$qb_variable = $qb_new;
-
 		}
 
 		// If we are "protecting identifiers" we need to examine the "from"