You are here

function recipe_autocomplete_page in Recipe 6

Same name and namespace in other branches
  1. 5 recipe.module \recipe_autocomplete_page()
  2. 7.2 recipe.admin.inc \recipe_autocomplete_page()
  3. 7 recipe.module \recipe_autocomplete_page()

Callback function for ingredient autocomplete

1 string reference to 'recipe_autocomplete_page'
recipe_menu in ./recipe.module
Implementation of hook_menu().

File

./recipe.module, line 1197
recipe.module - share recipes

Code

function recipe_autocomplete_page($string = "", $limit = 10) {
  $matches = array();
  $rs = db_query("SELECT name FROM {recipe_ingredient} WHERE LOWER(name) LIKE '%s%%' ORDER BY name LIMIT %d", strtolower($string), $limit);
  while ($r = db_fetch_object($rs)) {
    $matches[$r->name] = check_plain($r->name);
  }
  drupal_json($matches);
  exit;
}