function recipe_autocomplete_page in Recipe 5
Same name and namespace in other branches
- 6 recipe.module \recipe_autocomplete_page()
- 7.2 recipe.admin.inc \recipe_autocomplete_page()
- 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 922 - recipe.module - share recipes for drupal 5.x
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);
}
print drupal_to_js($matches);
exit;
}