summaryrefslogtreecommitdiffstats
path: root/system/database/DB_result.php
diff options
context:
space:
mode:
authordchill42 <dchill42@gmail.com>2012-10-23 04:59:09 +0200
committerdchill42 <dchill42@gmail.com>2012-10-23 04:59:09 +0200
commitc2f59ef2d5d3ef28a113a11c24bee25eb03eeb56 (patch)
treef704c46f5a71c7267cbf15e706a744a36e3da208 /system/database/DB_result.php
parentcf99aac39914d821e8864443d3aaa759f87258e9 (diff)
parentf5f898f8f30968fb36413a14de2dc6a4599b79a6 (diff)
Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into load_config_units
Diffstat (limited to 'system/database/DB_result.php')
-rw-r--r--system/database/DB_result.php19
1 files changed, 8 insertions, 11 deletions
diff --git a/system/database/DB_result.php b/system/database/DB_result.php
index d44df6c02..e747044d8 100644
--- a/system/database/DB_result.php
+++ b/system/database/DB_result.php
@@ -251,27 +251,24 @@ class CI_DB_result {
/**
* Query result. Acts as a wrapper function for the following functions.
*
- * @param string
+ * @param mixed
* @param string can be "object" or "array"
- * @return mixed either a result object or array
+ * @return mixed
*/
public function row($n = 0, $type = 'object')
{
if ( ! is_numeric($n))
{
// We cache the row data for subsequent uses
- if ( ! is_array($this->row_data))
- {
- $this->row_data = $this->row_array(0);
- }
+ is_array($this->row_data) OR $this->row_data = $this->row_array(0);
- // array_key_exists() instead of isset() to allow for MySQL NULL values
- if (array_key_exists($n, $this->row_data))
+ // array_key_exists() instead of isset() to allow for NULL values
+ if (empty($this->row_data) OR ! array_key_exists($n, $this->row_data))
{
- return $this->row_data[$n];
+ return NULL;
}
- // reset the $n variable if the result was not achieved
- $n = 0;
+
+ return $this->row_data[$n];
}
if ($type === 'object') return $this->row_object($n);