You are here

function _quotes_autocomplete_author in Quotes 5

Same name and namespace in other branches
  1. 6 quotes.module \_quotes_autocomplete_author()
  2. 7 quotes.module \_quotes_autocomplete_author()

Function to provide autocomplete for author field.

Parameters

$string - the string currently entered by the user.:

Return value

array of matches in JSON format.

1 string reference to '_quotes_autocomplete_author'
quotes_menu in ./quotes.module
Implementation of hook_menu().

File

./quotes.module, line 234

Code

function _quotes_autocomplete_author($string) {
  $matches = array();
  $result = db_query("SELECT name FROM {quotes_authors} WHERE LOWER(name) LIKE LOWER('%%%s%%')", $string);
  while ($row = db_fetch_object($result)) {
    $matches[$row->name] = check_plain($row->name);
  }
  print drupal_to_js($matches);
}