当前位置: 首页>>代码示例>>PHP>>正文


PHP product::updateProduct方法代码示例

本文整理汇总了PHP中product::updateProduct方法的典型用法代码示例。如果您正苦于以下问题:PHP product::updateProduct方法的具体用法?PHP product::updateProduct怎么用?PHP product::updateProduct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在product的用法示例。


在下文中一共展示了product::updateProduct方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateProduct_action

function updateProduct_action()
{
    $product_id = $_GET['product_id'];
    $name = $_POST['name'];
    $type = $_POST['type'];
    $price = $_POST['price'];
    $list_url = 'http://' . HOST . '/' . APPLICATION . '/index.php?page=home';
    $edit_url = 'http://' . HOST . '/' . APPLICATION . '/index.php?page=editProduct';
    $product = new product($name, $type, $price);
    $result = $product->updateProduct($product_id);
    if ($result) {
        header("Location: {$list_url}");
    } else {
        header("Location: {$edit_url}" . '&product_id=' . $product_id);
    }
}
开发者ID:kedika,项目名称:Login_Register_Example,代码行数:16,代码来源:product.php

示例2: array

         for ($i = 0; $i < count($_POST['thongso']); $i++) {
             $key = $_POST['thongso'][$i];
             $thongsokythuat[$key] = $_POST['giatri'][$i];
         }
         $image_phu = array();
         $ma_sp = $_POST['ma_sp'];
         $soluong = $_POST['soluong'];
         $position = isset($_POST['position']) ? $_POST['position'] : 0;
         $hot = $_POST['hot'];
         $status = $_POST['active'];
         $id = $_POST['id'];
         if (!empty($_FILES['file']['name'])) {
             $temp_name = explode(".", $_FILES["file"]["name"]);
             $newfilename = microtime() . '.' . end($temp_name);
             if (upload_image($_FILES['file'], $newfilename)) {
                 if ($pro_obj->updateProduct($pro_name, $newfilename, $tomtat, $description, $price_niemyet, $price_sale, $thongsokythuat, $image_phu, $ma_sp, $soluong, $position, $hot, $status, $cat_id, $mausac, $id)) {
                     header("Location: ../index.php?view=list-product&stt=success");
                 } else {
                     header("Location: ../index.php?view=list-product&stt=fail");
                 }
             }
         } else {
             if ($pro_obj->updateProduct($pro_name, '', $tomtat, $description, $price_niemyet, $price_sale, $thongsokythuat, $image_phu, $ma_sp, $soluong, $position, $hot, $status, $cat_id, $mausac, $id)) {
                 header("Location: ../index.php?view=list-product&stt=success");
             } else {
                 header("Location: ../index.php?view=list-product&stt=fail");
             }
         }
     }
     break;
 case "xoa":
开发者ID:vudinhkien,项目名称:APTECH,代码行数:31,代码来源:proccess-product.php

示例3: echoResponse

// Products
$app->get('/products', function () {
    $product = new product();
    $response = $product->getAllProduct();
    echoResponse(200, $response);
});
$app->post('/products', function () use($app) {
    $product = new product();
    $data = json_decode($app->request->getBody(), TRUE);
    $id = $product->AddProduct($data);
    echoResponse(200, $id);
});
$app->put('/products/:id', function ($id) use($app) {
    $product = new product();
    $data = json_decode($app->request->getBody(), TRUE);
    $result = $product->updateProduct($id, $data);
    // $rows["message"] = "Product information updated successfully.";
    echoResponse(200, $result);
});
$app->delete('/products/:id', function ($id) {
    $product = new product();
    $id = $product->deleteProduct($id);
    echoResponse(200, $id);
});
function echoResponse($status_code, $response)
{
    global $app;
    $app->status($status_code);
    $app->contentType('application/json');
    echo json_encode($response, JSON_NUMERIC_CHECK);
}
开发者ID:nikunj1806,项目名称:product-manager,代码行数:31,代码来源:index.php

示例4: header

        exit;
    } else {
        if ($product->addProduct($data)) {
            header('Location: ' . FRONTEND . 'inventory.php');
            exit;
        }
    }
} elseif (isset($_POST['action']) && $_POST['action'] == 'update') {
    $file = $_FILES;
    $data = $_POST['data']['Item'];
    if (isset($file['name'])) {
        $data['image'] = $file['name'];
    } else {
        $data['image'] = '';
    }
    if ($product->updateProduct($data)) {
        $_SESSION['message'] = 'Product has been updated successfully.';
        header('Location: ' . FRONTEND . 'inventory.php');
        exit;
    }
} elseif (isset($_GET['action']) && $_GET['action'] == 'delete') {
    $id = $_GET['id'];
    if ($product->deleteProduct($id)) {
        $_SESSION['message'] = 'Product has been deleted successfully.';
        header('Location: ' . FRONTEND . 'inventory.php');
        exit;
    }
} elseif (isset($_GET['action']) && $_GET['action'] == 'search') {
    $keyword = $_POST['keywords'];
    $products = $product->getSearchProducts($keyword);
    $smarty->assign('productcount', count($products));
开发者ID:roshanbhgt,项目名称:erp,代码行数:31,代码来源:inventory.php


注:本文中的product::updateProduct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。