Created
September 14, 2009 20:14
-
-
Save walker/186899 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Checks that a value is unique | |
| * | |
| * @param string $check Value to check | |
| * @param string $field Field to check for value | |
| * @return boolean Success | |
| * @access public | |
| */ | |
| function _isUnique($check, $field) { | |
| $conditions = array(); | |
| foreach($check as $c) { | |
| $conditions[] = "$this->name.$field=\"" . addslashes($c) . "\""; | |
| } | |
| if(isset($this->data[$this->name][‘id’])) | |
| { | |
| $conditions[] = "$this->name.id<>\"".addslashes($this->data[$this->name]['id'])."\""; | |
| } | |
| $results = $this->find($conditions); | |
| if(!empty($results)) | |
| { | |
| return false; | |
| } else { | |
| return true; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment