本文整理汇总了PHP中Color::find_all方法的典型用法代码示例。如果您正苦于以下问题:PHP Color::find_all方法的具体用法?PHP Color::find_all怎么用?PHP Color::find_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Color
的用法示例。
在下文中一共展示了Color::find_all方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CONCAT
$sql = "SELECT `b`.`breed_wk`, `b`.`pet_type_wk`, CONCAT(`p`.`name`,' - ',`b`.`name`) AS `name`, ";
$sql .= "`b`.`create_dt` FROM `breed` AS `b` INNER JOIN `pet_type` AS `p` ON `p`.`pet_type_wk` = `b`.`pet_type_wk` ";
$sql .= "WHERE `b`.`breed_wk` > 0 ORDER BY `p`.`name` ASC, `b`.`name` ASC";
$to_display = Breed::find_by_sql($sql);
//loop through all items
foreach ($to_display as $value) {
echo "<option value=\"" . $value->breed_wk . "\"";
echo ">" . $value->name . "</option>";
}
?>
</select></div>
Color: <br><div class="form-group"><select name="color" class="form-control">
<option value="0">Undefined</option>
<?php
//we need to display all available records
$to_display = Color::find_all();
//loop through all items
foreach ($to_display as $value) {
echo "<option value=\"" . $value->color_wk . "\"";
echo ">" . $value->name . "</option>";
}
?>
</select></div>
Status: <br><div class="form-group"><select name="status" class="form-control">
<option value="0" >Undefined</option>
<?php
//we need to display all available records
$to_display = Status::find_all();
//loop through all items
foreach ($to_display as $value) {
echo "<option value=\"" . $value->status_wk . "\"";
示例2: redirect_head
}
}
}
// redirect for colors(s) were updated but no new color added
redirect_head(ROOT_URL . "admin/manage_colors.php");
}
//header template
require_once "../requires/template/header.php";
?>
<section id="registration" class="container"><form class="center" role="form" action="<?php
echo file_name_with_get();
?>
" method="post" ><fieldset class="registration-form">
<?php
$colors_array = Color::find_all();
$count = count($colors_array);
for ($i = 0; $i < $count; $i++) {
echo "<div class=\"form-group\"><input type=\"text\" class=\"form-control\" name=\"" . $i . "\" value=\"" . $colors_array[$i]->name . "\">";
echo "<a href=\"manage_colors.php?delete_color_wk=" . $colors_array[$i]->color_wk . "\">Delete</a> </div>";
}
?>
<br>
Add new color:<input type="text" name="new_color" class="form-control" value=""><br />
<div class="form-group"><button type="submit" value="submit" name="submit" class="btn btn-success btn-md btn-block">Submit</button></div>
</fieldset></form></section>
<?php
//this is a special instance, remove the message, if it's set since we set the messages in this form
$session->unset_variable('message');