Sorry but this feature was changed. Lookup nutritional information for food, here.


"; search_form_lookup(''); echo "
"; ?>

Nutritional Information for


"; search_form_lookup(vr_str('key')); echo "
  We didn't find any results. Try a more general name for the food you are looking for."; } else { echo "

"; search_form_lookup(vr_str('key')); echo "
"; $key = vr_str('key'); if ( substr($key, -1 ) == '!' ){ $key = substr($key, 0, -1); } ?>

Search for

");'>

"> \n"; } ?> '9' ) ORDER BY rda.rda_value IS NOT NULL DESC, nd.Nutr_No, w.Gm_Wgt ASC "); $weight_rec = sdb_get_rec($GLOBALS['conf_db'], " SELECT * FROM WEIGHT w, measurement m WHERE w.NDB_No = '$ndb_no' AND w.Msre_Desc LIKE CONCAT('%', m.measurement_name, '%') limit 1 "); # var_export($weight_recs); # 236 is milliliters in cup. # measurement_milliliters is millis in the measurement. amount is the amount of hte mearurement. # @ $volume_in_cups = ( $weight_rec['measurement_milliliters'] * $weight_rec['Amount'] ) / 236; $weight_grams = $nutr_recs[0]['Gm_Wgt']; list($water_grams, $fiber_grams, $calories) = array(0,0,0); foreach($nutr_recs as $nrec){ if ( $nrec['NutrDesc'] == 'Water' ) $water_grams = $nrec['nutrient_amount']; if ( $nrec['NutrDesc'] == 'Fiber, total dietary' ) $fiber_grams = $nrec['nutrient_amount']; if ( $nrec['NutrDesc'] == 'Energy (Calories)' ) $calories = $nrec['nutrient_amount']; } # echo "$weight_grams, $water_grams, $fiber_grams, $calories\n"; ?> class='aevenrow' class='aoddrow' >
NutrientValueDaily RecommendationPotential
Size
$permutation){ $permutations[$i] = '%' . $permutations[$i] . '%'; } $like_strings = array_merge($like_strings, $permutations); } if ( count($key_words) > 1 ){ foreach($key_words as $word){ $like_strings[] = "%$word%"; } } } # #echo "
";
  #echo $key . "\n";
  #var_export($like_strings);
  #echo "
"; # $food_res = array(); foreach($like_strings as $str){ if ( substr($str,-1) != '%' ){ # search for a food. $food_recs = sdb_get_recs($GLOBALS['conf_db'], " SELECT fd.* FROM usdasr22.FOOD_DES fd WHERE fd.Long_Desc = '$str' ORDER BY fd.Long_Desc ASC "); if ( !empty($food_recs) ) $food_res =array_merge($food_res, $food_recs); if (count($food_res) > 0 ) return $food_res; # search for a group $food_recs = sdb_get_recs($GLOBALS['conf_db'], " SELECT fd.* FROM usdasr22.FOOD_DES fd, FD_GROUP g WHERE fd.FdGrp_Cd = g.FdGrp_Cd AND FdGrp_Desc = '$str' ORDER BY fd.Long_Desc ASC "); if ( !empty($food_recs) ) $food_res =array_merge($food_res, $food_recs); if (count($food_res) > 0 ) return $food_res; # search for a vitamin $is_nutrient = sdb_get_rec($GLOBALS['conf_db'], " SELECT * FROM NUTR_DEF WHERE NutrDesc = '$str' LIMIT 1 "); if ( $is_nutrient ){ $food_recs = sdb_get_recs($GLOBALS['conf_db'], " SELECT fd.* FROM usdasr22.NUTR_DEF def JOIN usdasr22.FOOD_DES fd JOIN usdasr22.NUT_DATA nd JOIN usdasr22.WEIGHT w WHERE w.NDB_No = nd.NDB_No AND w.Seq = '1' AND def.Nutr_No = nd.Nutr_No AND def.NutrDesc = '$str' AND fd.NDB_No = nd.NDB_No AND fd.FdGrp_Cd IN ( '1600', '2000', '0200', '0900', '1100', '1200' ) ORDER BY nd.Nutr_Val * w.Gm_Wgt DESC LIMIT 500 "); $GLOBALS['is_nutrient']= true; return $food_recs; } } else { $food_recs = sdb_get_recs($GLOBALS['conf_db'], " SELECT * FROM usdasr22.FOOD_DES WHERE Long_Desc LIKE '$str' ORDER BY Long_Desc ASC LIMIT $num_matches "); if ( !empty($food_recs) && $food_recs[0] !== NULL ) $food_res = array_merge($food_res, $food_recs); $food_res =array_merge($food_res, $food_recs); if (count($food_res) > $num_matches ) return $food_res; } } return $food_res; }/*}}}*/ function like_search_permute($key_words, $delimiter=' '){/*{{{*/ if ( count($key_words) <= 1 ) return $key_words; $permutations = array(); foreach($key_words as $index => $key_word){ $word = $key_words[$index]; unset($key_words[$index]); $new_permutations = like_search_permute($key_words, $delimiter); $key_words[$index] = $word; foreach($new_permutations as $pindex => $permutation){ $new_permutations[$pindex] = $word . $delimiter . $permutation; } $permutations = array_merge($permutations, $new_permutations); } return $permutations; } /*}}}*/ function remove_dupes($food_res){/*{{{*/ # remove dupes. if ( empty($food_res) ) return array(); $cnt = count($food_res); for($k = 0; $k < $cnt; $k++){ for($k2=$k + 1; $k2 < $cnt; $k2++){ if ( empty($food_res[$k2]) || empty($food_rec[$k]) ) continue; if ( $food_res[$k]['NDB_No'] == $food_res[$k2]['NDB_No'] ){ unset($food_res[$k2]); } } } # put the shortest at the front. $shortest_len = 1000; $shortest = 0; foreach($food_res as $k => $data){ if ( empty($food_res[$k]) ) continue; if ( strlen($food_res[$k]['Long_Desc']) < $shortest_len ){ $shortest_len = strlen($food_res[$k]['Long_Desc']); $shortest = $k; } } $foo = $food_res[$shortest]; unset($food_res[$shortest]); array_unshift($food_res, $foo); return $food_res; }/*}}}*/ function percent_comment($volume_cups, $weight_grams, $water_grams, $fiber_grams, $calories, $amount, $rda){ if ( ! $rda ) return; list($total_servings, $min_type) = get_potential_serving($volume_cups, $weight_grams, $water_grams, $fiber_grams, $calories); $total_amount = $total_servings * $amount; $tier = $total_amount / $rda; ?>%