本文整理汇总了PHP中DBUtils::fetchColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtils::fetchColumn方法的具体用法?PHP DBUtils::fetchColumn怎么用?PHP DBUtils::fetchColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBUtils
的用法示例。
在下文中一共展示了DBUtils::fetchColumn方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Export
/**
Constructor, creates the exporting object and the correct subclass based on the param $filter
*/
function Export($filter = 'XML')
{
global $db_table_courses, $db_table_bases, $db_table_ethnicity, $db_table_prep_time, $db_table_difficulty, $db_table_units, $db_table_locations;
$this->useFilter = $filter;
// Look up the field values
$this->courses = DBUtils::createList(DBUtils::fetchColumn($db_table_courses, 'course_desc', 'course_id', 'course_desc'), 'course_id', 'course_desc');
$this->bases = DBUtils::createList(DBUtils::fetchColumn($db_table_bases, 'base_desc', 'base_id', 'base_desc'), 'base_id', 'base_desc');
$this->ethnicity = DBUtils::createList(DBUtils::fetchColumn($db_table_ethnicity, 'ethnic_desc', 'ethnic_id', 'ethnic_desc'), 'ethnic_id', 'ethnic_desc');
$this->prep_times = DBUtils::createList(DBUtils::fetchColumn($db_table_prep_time, 'time_desc', 'time_id', 'time_desc'), 'time_id', 'time_desc');
$this->difficulty = DBUtils::createList(DBUtils::fetchColumn($db_table_difficulty, 'difficult_desc', 'difficult_id', 'difficult_desc'), 'difficult_id', 'difficult_desc');
$this->units = DBUtils::createList(DBUtils::fetchColumn($db_table_units, 'unit_desc', 'unit_id', 'unit_desc'), 'unit_id', 'unit_desc');
$this->locations = DBUtils::createList(DBUtils::fetchColumn($db_table_locations, 'location_desc', 'location_id', 'location_desc'), 'location_id', 'location_desc');
}
示例2: array
<table cellspacing="1" cellpadding="2" border="0" class="data">
<tr>
<th colspan = "2">
<?php
if ($ingredient_id) {
echo $LangUI->_('Edit Ingredient');
} else {
echo $LangUI->_('Add Ingredient');
}
?>
</th>
</tr>
<?php
$units = Units::getAllUnits();
// Load the units
$rc_locations = DBUtils::fetchColumn($db_table_locations, 'location_desc', 'location_id', 'location_desc');
$locations = DBUtils::createList($rc_locations, 'location_id', 'location_desc');
$liqsol = array("FALSE" => $LangUI->_('Liquid'), "TRUE" => $LangUI->_('Solid'));
$ingredient_name = "";
$ingredient_desc = "";
$ingredient_unit = "";
$ingredient_loc = "";
$ingredient_solid = "";
$coreingredient_id = "";
$coreingredient_Name = "";
if ($ingredient_id) {
$ingredient_name = $ingredients->fields['ingredient_name'];
$ingredient_desc = $ingredients->fields['ingredient_desc'];
$ingredient_unit = $ingredients->fields['ingredient_unit'];
$ingredient_loc = $ingredients->fields['ingredient_location'];
$ingredient_solid = $ingredients->fields['ingredient_solid'];
示例3: isset
$rc = DBUtils::fetchColumn($db_table_prep_time, 'time_desc', 'time_id', 'time_desc');
echo $rc->getMenu2('recipe_prep_time', isset($recipe['recipe_prep_time']) ? $recipe['recipe_prep_time'] : "", false);
?>
</td>
</tr>
<tr>
<td><?php
echo $LangUI->_('Difficulty');
?>
:<?php
echo getHelpLink("difficulty");
?>
</td>
<td>
<?php
$rc = DBUtils::fetchColumn($db_table_difficulty, 'difficult_desc', 'difficult_id', '0');
echo $rc->getMenu2('recipe_difficulty', isset($recipe['recipe_difficulty']) ? $recipe['recipe_difficulty'] : "", false);
?>
</td>
</tr>
<tr>
<td><?php
echo $LangUI->_('Number of Servings');
?>
:<?php
echo getHelpLink("servings");
?>
</td>
<td><input type="text" name="recipe_serving_size" id="recipe_serving_size" class="required number" size="3" value="<?php
echo isset($recipe["recipe_serving_size"]) ? $recipe["recipe_serving_size"] : "";
?>
示例4: get
/**
Gets the meals for a given day and puts it into html and returns it as a string
@param $date The date to get (ISO Format)
@param $format The format to put it in, maily big=1, small=2, mobile=3
@return String with HTML in it
*/
function getMeals($date, $format)
{
global $DB_LINK, $db_table_meals;
$output = "";
// If there is nothing to get, don't bother, just return
if (!isset($this->mealplanItems[$date])) {
return "";
}
// Get the list of all the meal types (breakfast, lunch...)
if (count($this->mealList) == 0) {
// we have to load the list of meals now
$rc = DBUtils::fetchColumn($db_table_meals, 'meal_name', 'meal_id', 'meal_id');
$this->mealList = DBUtils::createList($rc, 'meal_id', 'meal_name');
}
// Now that we know there is something to get
foreach ($this->mealList as $k => $v) {
$count = 0;
$str = "";
foreach ($this->mealplanItems[$date] as $item) {
if ($item['meal'] == $k) {
// add this one ·
if ($format == 1 || $format == 2) {
$str .= '<li><a href="index.php?m=recipes&a=view&recipe_id=' . $item['id'] . '">' . $item['name'] . "</a>\n";
} else {
if ($format == 3) {
$str = '<li><a href="index.php?m=recipes&a=view_mob&recipe_id=' . $item['id'] . '">' . $item['name'] . "</a></li>";
}
}
$count++;
}
}
if ($count) {
if ($format == 1 || $format == 2) {
$output .= "{$v}<ul>" . $str . "</ul>";
} else {
if ($format == 3) {
$output .= '<li data-role="list-divider">' . $v . "</li>\n{$str}";
}
}
}
}
return $output;
}
示例5: array
?>
<table cellspacing="0" cellpadding="1" border="0" width="100%">
<tr>
<td align="left" class="title"><?php
echo $LangUI->_('Export Recipes');
?>
</td>
</tr>
</table>
<p>
<?php
if ($mode == '') {
// Read in the list of options now
$rc = DBUtils::fetchColumn($db_table_recipes, 'recipe_name', 'recipe_id', 'recipe_name');
$arr2 = array('XML' => $LangUI->_('PHPRecipeBook Format'), 'RecipeML' => $LangUI->_('RecipeML Format'));
?>
<form action="./index.php?m=recipes&a=export" method="POST">
<table cellpadding="2">
<tr>
<td ALIGN=left><?php
echo $LangUI->_('Recipe');
?>
: </td>
<td>
<?php
echo $rc->getMenu2('recipe_id', $recipe_id, false);
?>
</td>
</tr><tr>
示例6: isset
$view = isset($_GET['view']) ? $_GET['view'] : "daily";
$dbDate = DBUtils::dbDate($date);
// get the date in ISO format so that we have the key
if ($SMObj->getUserLoginID() == NULL) {
die($LangUI->_('You must be logged in to use the Meal Planner!'));
}
// Create a new meal plan object
$MPObj = new MealPlan($date);
$MPObj->load($dbDate, $dbDate);
//just want this one day
$minshow = 4;
// Min number of empty fields to show
$defaultServings = 2;
// The default number of servings
// Read in a list of Meals and recipes
$rc = DBUtils::fetchColumn($db_table_meals, 'meal_name', 'meal_id', 'meal_id');
$mealList = DBUtils::createList($rc, 'meal_id', 'meal_name');
?>
<script type="text/javascript">
$(document).ready(function() {
$(".ui-widget").find("input[id^='recipeAuto_']").each(function()
{
$(this).autocomplete({
source: "index.php?m=recipes&a=get&format=no",
minLength: 1,
select: function(event, ui) {
var $target = $(event.target);
var recipeIdName = getOtherFromName($target.attr("id"), "recipeId");
var mealType = getOtherFromName($target.attr("id"), "meal_id");
$(recipeIdName).val(ui.item.id);
$(mealType).attr("required", "");
示例7: loaded
/**
Imports all of the recipes currently loaded (do a parseDataFile first)
*/
function importData()
{
global $LangUI, $DB_LINK, $SMObj, $db_table_recipes, $db_table_ingredients, $db_table_related_recipes;
// Iterate through all the recipes and create them
foreach ($this->importRecipes as $item) {
$recipeObj = $item[0];
$recipeObj->user = $SMObj->getUserID();
$id = $recipeObj->insert();
$order = 0;
// order the ingredients
foreach ($item[1] as $ingObj) {
if ($ingObj != NULL) {
// See if the ingredient exists
$sql = "SELECT ingredient_id FROM {$db_table_ingredients} WHERE ingredient_name=? and ingredient_user=?";
$stmt = $DB_LINK->Prepare($sql);
$rc = $DB_LINK->Execute($stmt, array($ingObj->name, $SMObj->getUserID()));
// Error check
DBUtils::checkResult($rc, NULL, NULL, $sql);
if ($rc->RecordCount() == 0) {
// Note: lots of defaults are guessed if this option is taken
$ingObj->solid = $DB_LINK->true;
$ingObj->price = '0.00';
$ingObj->user = $SMObj->getUserID();
// Create the Ingredient and then set the ID
$ing_id = $ingObj->insert();
} else {
$ing_id = $rc->fields['ingredient_id'];
}
// Map the ingredient
$ingObj->id = $ing_id;
// We have an ID set it.
$ingObj->recipe_id = $id;
// Set the Recipe ID as well
$ingObj->order = $order;
// Set the order of the ingredient
// Insert the mapping
$ingObj->insertMap();
$order++;
}
}
}
// Now we can link in the related recipes...
$this->recipes = DBUtils::createList(DBUtils::fetchColumn($db_table_recipes, 'recipe_name', 'recipe_id', 'recipe_name'), 'recipe_name', 'recipe_id');
foreach ($this->relatedRecipes as $link) {
if ($this->recipes[$link[0]] != NULL && $this->recipes[$link[1]] != NULL) {
$sql = "INSERT INTO {$db_table_related_recipes} (related_parent, related_child, related_required) VALUES (?, ?, ?)";
$stmt = $DB_LINK->Prepare($sql);
$rc = $DB_LINK->Execute($stmt, array($this->recipes[$link[0]], $this->recipes[$link[1]], $link[2]));
DBUtils::checkResult($rc, NULL, NULL, $sql);
echo $LangUI->_('Linking') . ": '" . $link[0] . "' " . $LangUI->_('to') . " '" . $link[1] . "'<br />";
}
}
}