本文整理汇总了PHP中Products::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Products::update方法的具体用法?PHP Products::update怎么用?PHP Products::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products
的用法示例。
在下文中一共展示了Products::update方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveAction
/**
* Create/update a product record in the database
*/
public function saveAction()
{
$productsTable = new Products();
$form = $this->getForm();
if ($form->isValid($_POST)) {
$values = $form->getValues();
$id = $this->_hasParam('id') ? $this->_getParam('id') : null;
unset($values['product_id'], $values['submit']);
if (isset($id) && $id != null) {
$productsTable->update($values, array('product_id = ?' => $id));
} else {
$id = $productsTable->insert($values);
}
$this->_redirect('/products/view/id/' . $id);
} else {
echo $form;
}
}
示例2: trim
/**
* 更新国家信息
* @access public
*/
function update_save()
{
$id = get_post_value('product_id');
$product_url = get_post_value('product_url');
$title_cn = get_post_value('title_cn');
$title_th = get_post_value('title_th');
$category_1 = get_post_value('category_1');
$category_2 = get_post_value('category_2');
$category_3 = get_post_value('category_3');
$floor_1 = get_post_value('floor_1');
$floor_2 = get_post_value('floor_2');
$floor_3 = get_post_value('floor_3');
$purchase_price = trim(get_post_value('purchase_price'));
$sales_price = trim(get_post_value('sales_price'));
$start_time = get_post_value('start_time');
$end_time = get_post_value('end_time');
$image_url = trim(get_post_value('image_url')) == '' ? get_post_value('image_url_old') : get_post_value('image_url');
$product_url = get_post_value('product_url');
$shop_id = get_post_value('shop_id');
$shop = get_post_value('shop');
$shop_url = get_post_value('shop_url');
$preferential_price = get_post_value('preferential_price');
$field = array('title_cn' => trim($title_cn), 'title_th' => trim($title_th), 'category_3_id' => trim($category_3), 'floor_3_id' => trim($floor_3), 'purchase_price' => intval($purchase_price), 'sales_price' => intval($sales_price), 'preferential_price' => intval($preferential_price), 'image_url' => trim($image_url), 'product_url' => trim($product_url), 'shop' => trim($shop), 'start_time' => $start_time, 'end_time' => $end_time, 'hits' => '0', 'buys' => '0', 'favorites' => '0', 'created' => time(), 'created_name' => '', 'upload_name' => '', 'status' => '10000', 'category_1_id' => $category_1);
$m = new Products();
$m->clear();
$m->setTable('vcb_product');
//设置表名
$m->setField($field);
///设置更新字段及值,(键值数组)
$m->setWhere('product_id', '=', $id);
//设置Where条件
$m->update();
//返回
echo '<br>操作成功,<a href="index" >返回</a><br>';
}
示例3: trim
function update_sizesave()
{
$size = trim(get_post_value('u_size'));
$id = get_post_value('id');
//echo $pro_k_id;
$ve = $this->verify_kind($id);
// var_dump($ve);
if (empty($ve)) {
header('Location:error.php');
}
$m = new Products();
$field = array('size' => $size);
$m->clear();
$m->setField($field);
$m->setTable(' vcb_product_ksize ');
$m->setWhere('id', '=', $id);
$data = $m->update();
if (!empty($data)) {
header('Location:add_size?id=' . $id);
}
}
示例4: elseif
<input type="submit" value="Save" style="width:100%;height:100%;"></button>
</td>
</form>
<?php
echo "</tr>";
}
echo " </tbody></table></div></div>";
} elseif ($_GET['y'] == 3) {
$array = $product->delete($_GET['z']);
} elseif ($_GET['y'] == 2) {
$prod = new Products();
$prod->name = $_POST['name'];
$prod->price = $_POST['price'];
$prod->qty = $_POST['qty'];
$prod->sale = $_POST['sale'];
$prods = $prod->update($_POST['id']);
}
}
?>
</div>
<!-- /. ROW -->
</div>
<!-- /. PAGE INNER -->
</div>
<!-- /. PAGE WRAPPER -->
</div>
<!-- /. WRAPPER -->
<!-- JS Scripts-->
<!-- jQuery Js -->
示例5: getById
}
class Users extends Table
{
// 针对于Users表的操作
function getById()
{
$sql = '.....';
}
}
class Products extends Table
{
// 针对Products表的操作
function showoff()
{
$sql = 'XXXX products';
}
}
class Admins extends Table
{
function changePermissions()
{
$sql = '....';
}
}
$users = new Users();
$users->delete();
echo '这张表叫', $users->getTableName(), '<br/><br/>';
$p = new Products();
$p->update();
$a = new Admins();
$a->insert();
示例6: switch
$collection_name = $settings['collection']['name'];
if (isset($_POST['submit'])) {
if (isset($_GET['move'])) {
$db->update("products", "collection_id", $_POST['collection_id'], $_GET['move']);
$html->redirection("products.php?c=" . $_POST['collection_id'] . "&p=" . $_GET['move']);
} else {
$products->set_data();
$error = $products->check_data();
if (!$error) {
switch ($_GET['p']) {
case 'add':
$products->create();
$html->redirection("products.php?c=" . $_GET['c'] . "&p=add");
break;
default:
$products->update();
$html->redirection("products.php?c=" . $_GET['c'] . (isset($_GET['f']) ? "&f=" . $_GET['f'] : ''));
break;
}
}
}
}
if (isset($_GET['p'])) {
$products->get_data();
echo "<div id='page-title' class='row'>";
echo "<div class='col-xs-12 col-sm-6'>";
$html->title($_GET['p'] == "add" ? "Add Product" : "{$products->name}", "Collection: {$collection_name}", "left");
echo "</div>";
$products->form();
} else {
if (isset($_GET['d'])) {
示例7: delete
/**
* 删除国家
* @access public
*/
function delete()
{
$id = get_post_value('id');
$field = array('status' => '50000');
$m = new Products();
$m->clear();
$m->setField($field);
///设置更新字段及值,(键值数组)
$m->setTable('vcb_product');
//设置表名
$m->setWhere('product_id', '=', $id);
//设置Where条件
$m->update();
//返回
echo '<br>操作成功,<a href="index" >返回</a><br>';
}