本文整理匯總了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);