diff options
author | Eric Barnes <eric@ericlbarnes.com> | 2011-12-04 16:31:10 +0100 |
---|---|---|
committer | Eric Barnes <eric@ericlbarnes.com> | 2011-12-04 16:31:10 +0100 |
commit | 180046646700ad869b8f8b8798321b4f8e4105c6 (patch) | |
tree | 06709261dc1c0778922a32f5ed73693ea28f6780 /system | |
parent | 1d861530da2d598f14c16c68461d83cd5c25bdf6 (diff) | |
parent | 2a3b40d6eff1600e3b70d9a8b6bb35a91dc847d6 (diff) |
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into develop
Diffstat (limited to 'system')
-rw-r--r-- | system/libraries/Form_validation.php | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 5663da981..918f6904c 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -5,9 +5,9 @@ * An open source application development framework for PHP 5.1.6 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: @@ -949,7 +949,7 @@ class CI_Form_validation { return ($str !== $field) ? FALSE : TRUE; } - + // -------------------------------------------------------------------- /** @@ -962,10 +962,13 @@ class CI_Form_validation { */ public function is_unique($str, $field) { - list($table, $field)=explode('.', $field); - $query = $this->CI->db->limit(1)->get_where($table, array($field => $str)); - - return $query->num_rows() === 0; + list($table, $field) = explode('.', $field); + if (isset($this->CI->db)) + { + $query = $this->CI->db->limit(1)->get_where($table, array($field => $str)); + return $query->num_rows() === 0; + } + return FALSE; } // -------------------------------------------------------------------- |