You are here

function recipe_get_ingredients in Recipe 6

1 call to recipe_get_ingredients()
recipe_ingredient_index_page in ./recipe_ingredient_index.inc
@file recipe_ingredient_index.inc - This is an include file containing most all of the recipe category index page functionality.

File

./recipe_ingredient_index.inc, line 128
recipe_ingredient_index.inc - This is an include file containing most all of the recipe category index page functionality.

Code

function recipe_get_ingredients($iid = NULL) {
  if ($iid == NULL) {
    $result = db_query("SELECT DISTINCT ri.id, ri.name FROM {recipe_ingredient} ri, {recipe_node_ingredient} rni WHERE ri.id=rni.ingredient_id ORDER BY name");
  }
  else {
    $result = db_query("SELECT DISTINCT ri.id, ri.name FROM {recipe_ingredient} ri, {recipe_node_ingredient} rni  WHERE ri.id=rni.ingredient_id AND ri.id=%d ORDER BY name", $iid);
  }
  $list = array();
  while ($row = db_fetch_object($result)) {
    $list[] = $row;
  }
  return $list;
}