You are here

function recipe_load_ingredients in Recipe 6

Same name and namespace in other branches
  1. 5 recipe.module \recipe_load_ingredients()
  2. 7 recipe.module \recipe_load_ingredients()

Loads the ingredients for a recipe

1 call to recipe_load_ingredients()
recipe_load in ./recipe.module
Implementation of hook_load().

File

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

Code

function recipe_load_ingredients($node) {
  $rs = db_query("\n  SELECT\n    ri.id as 'ri_id',\n    i.name,\n    ri.note,\n    i.link,\n    ri.quantity,\n    ri.unit_id,\n    ri.weight,\n    u.abbreviation,\n    ri.ingredient_id\n  FROM\n    {recipe_node_ingredient} ri,\n    {recipe_ingredient} i,\n    {recipe_unit} u\n  WHERE\n    ri.ingredient_id = i.id\n    AND ri.unit_id = u.id\n    AND ri.nid = %d\n  ORDER BY\n  ri.weight, ri.id", $node->nid);
  $ingredients = array();
  while ($ingredient = db_fetch_array($rs)) {
    $ingredients[] = $ingredient;
  }
  return $ingredients;
}