* of the SM_ABOOK_FIELD_* constants
* defined in include/constants.php
* (OPTIONAL; defaults to nickname field)
+ * NOTE: uniqueness is only guaranteed
+ * when the nickname field is used here;
+ * otherwise, the first matching address
+ * is returned.
*
* @return array Array with lookup results when the value
* was found, an empty array if the value was
return false;
}
+ $db_field = $this->get_field_name($field);
+ if ($db_field == 'ERROR') {
+ return $this->set_error(sprintf(_("Unknown field name: %s"), $field));
+ }
+
$query = sprintf("SELECT * FROM %s WHERE owner = '%s' AND LOWER(%s) = '%s'",
- $this->table, $this->owner, $this->get_field_name($field),
+ $this->table, $this->owner, $db_field,
$this->dbh->quoteString($value));
$res = $this->dbh->query($query);