本文整理汇总了PHP中Style::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Style::update方法的具体用法?PHP Style::update怎么用?PHP Style::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Style
的用法示例。
在下文中一共展示了Style::update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Style
<?php
include '../menu_top.php';
?>
<h2>Update brewery</h2>
<?php
require_once '../../models/style.php';
if (isset($_POST['newName']) && isset($_POST['description']) && isset($_POST['id'])) {
$id = $_POST['id'];
$newName = $_POST['newName'];
$description = $_POST['description'];
if (empty($newName) || empty($description) || empty($id)) {
echo "<br><div class='alert alert-info col-md-8'>All fields are required!</div>";
} else {
$style = new Style();
echo "asdasd";
if ($up = $style->update($id, $newName, $description)) {
header('Location: index.php');
die;
}
}
}
?>
<form id='new-style-form' action='', method='POST'>
<div class="col-md-8">
<table class="table table-striped">
<tr>
<th>Name:</th>
<td>
<input type='text' name='newName' value="<?php
if (isset($_POST['name'])) {
echo $_POST['name'];
示例2: MAX
$UpdateStyleQueryId = mysql_query($UpdateStyleQuery);
$GetStyleIdQuery = "SELECT MAX(i_StyleSheetId) i_StyleSheetId FROM StyleSheet where i_UID = {$hdnUserId}";
$GetStyleIdQueryId = mysql_query($GetStyleIdQuery);
$GetStyleIdResults = mysql_fetch_object($GetStyleIdQueryId);
$selUserStyle = $GetStyleIdResults->i_StyleSheetId;
$UpdateStyleQueryId = $style->create($selUserStyle, $txtStyleSheet);
} else {
$selUserStyle = $hdnStyleId;
$UpdateStyleQuery = "UPDATE StyleSheet ";
$UpdateStyleQuery .= " set i_UID = {$hdnUserId},";
$UpdateStyleQuery .= " i_StyleSheetTypeId = 1,";
$UpdateStyleQuery .= " i_Public = {$iStylePublic},";
$UpdateStyleQuery .= " vc_Name = \"{$txtStyleName}\"";
$UpdateStyleQuery .= " WHERE i_StyleSheetId = {$hdnStyleId}";
$UpdateStyleQueryId = mysql_query($UpdateStyleQuery);
$UpdateStyleQueryId = $style->update($hdnStyleId, $txtStyleSheet);
if (!empty($btnMakeStyle)) {
$UpdateUserStyleQuery = "DELETE FROM UserStyleSheet WHERE i_UID = {$hdnUserId}";
$UpdateUserStyleQueryId = mysql_query($UpdateUserStyleQuery);
$UpdateUserStyleQuery = "INSERT INTO UserStyleSheet (i_UID, i_StyleSheetId)";
$UpdateUserStyleQuery .= " VALUES ({$hdnUserId}, {$hdnStyleId})";
$UpdateUserStyleQueryId = mysql_query($UpdateUserStyleQuery);
}
}
} else {
if (!empty($btnMakePublicStyle)) {
$UpdateUserStyleQuery = "DELETE FROM UserStyleSheet WHERE i_UID = {$hdnUserId}";
$UpdateUserStyleQueryId = mysql_query($UpdateUserStyleQuery);
$UpdateUserStyleQuery = "INSERT INTO UserStyleSheet (i_UID, i_StyleSheetId)";
$UpdateUserStyleQuery .= " VALUES ({$hdnUserId}, {$hdnPublicStyleId})";
$UpdateUserStyleQueryId = mysql_query($UpdateUserStyleQuery);