summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/database/DB_query_builder.php7
-rw-r--r--user_guide_src/source/database/query_builder.rst2
2 files changed, 3 insertions, 6 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 0d0421306..fb8514f5c 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -2557,22 +2557,19 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
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"
diff --git a/user_guide_src/source/database/query_builder.rst b/user_guide_src/source/database/query_builder.rst
index 5e0dcb4be..480067407 100644
--- a/user_guide_src/source/database/query_builder.rst
+++ b/user_guide_src/source/database/query_builder.rst
@@ -1055,4 +1055,4 @@ run the query::
$data = $this->db->get()->result_array();
// Would execute and return an array of results of the following query:
- // SELECT field1, field1 from mytable where field3 = 5;
+ // SELECT field1, field1 from mytable where field3 = 5; \ No newline at end of file