code: public function isUnique($field, $val, $customError = false)
      {
          $row = $this->getRow(array($field => $val));
  
          if ($row) {
              $this->log->report("There was a match for $field = $val");
              $this->log->formError($field, $customError ? $customError : "The {$field} {$val} exists in database");
              return true;
          } else {
              $this->log->report("No Match for $field = $val");
              return false;
          }
      }
docs: Test field value in database
  Check for the uniqueness of a value in a specified field/column.
  For example could be use to check for the uniqueness of a Username
  or email prior to registration
  
  @param string      $field       The name of the field
  @param string|int  $val         The value for the field to check
  @param bool|string $customError Error string to log if field value is not unique
  
  @return bool