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


PHP product::fetch方法代码示例

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


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

示例1: get_products

function get_products()
{
    include_once 'product.php';
    $obj = new product();
    if (!$obj->connect()) {
        $json = '{"status":2, "products":{}}';
        echo $json;
        exit;
    }
    if ($obj->get_products()) {
        $row = $obj->fetch();
        $length = $obj->get_num_rows();
        //            Products as a set
        $json = '{"status":0, "products":{';
        for ($i = 0; $i < $length; $i++) {
            $bcode = $row['PRODUCT_BARCODE'];
            $json = $json . '"' . $bcode . '":' . json_encode($row);
            $row = $obj->fetch();
            if ($i < $length - 1) {
                $json = $json . ',';
            }
        }
        $json = $json . '}}';
        //            Products as an array
        //            $json='{"status":0, "products":[';
        //            for($i=0; $i<$length; $i++){
        //
        //                $bcode = $row['PRODUCT_BARCODE'];
        //                $json=$json.'{"'.$bcode.'":'.json_encode($row).'}';
        //                $row=$obj->fetch();
        //                if($i<$length-1){
        //                    $json=$json.',';
        //                }
        //            }
        //            $json=$json.']}';
        echo $json;
        //            $d = json_decode($json);
        //            print_r($d);
    } else {
        $json = '{"status":1, "products":{}}';
        echo $json;
    }
}
开发者ID:sheamuspy,项目名称:vendite-owner,代码行数:43,代码来源:teller_function.php

示例2: getStock

function getStock()
{
    $message = $_REQUEST["message"];
    $mess = explode(" ", $message);
    $pnum = $_REQUEST["pnum"];
    include "product.php";
    $obj = new product();
    if ($obj->displayProduct($mess[0])) {
        $row = $obj->fetch();
        $msg = $row['pname'] + "<br>" + $row['price'] + "<br>" + $row['qty'];
        echo $msg;
        // sms($msg,$pnum);
    } else {
        echo '{"result":0}';
    }
}
开发者ID:adjoamaison,项目名称:midsemproject,代码行数:16,代码来源:response.php

示例3: utf8_encode

<?php

include "../classes/product.php";
$obj = new product();
$row = $obj->get_all_products();
$html = "";
while ($row) {
    $html .= "<div id = 'home1' data-role = 'collapsible'>";
    $html .= "<h1>{$row['name']}</h1>";
    $html .= "<ul id = 'theList' data-role='listview'>";
    $html .= "<li><a href='#'>Product Code: {$row['code']}</a></li>";
    $html .= "<li><a href='#'>Product Name: {$row['name']}</a></li>";
    $html .= "<li><a href='#'>Selling Price : GHC {$row['selling_price']}</a></li>";
    $html .= "<li><a href='#'>Cost Price : GHC {$row['cost_price']}</a></li>";
    $html .= "<li><a href='#'>Quantity in Stock : {$row['stock_level']}</a></li></ul>";
    $html .= "</div>";
    $row = $obj->fetch();
}
echo utf8_encode($html);
?>
		
开发者ID:kobina-nsiah,项目名称:pos,代码行数:20,代码来源:viewinventory.php

示例4: product

<?php

include_once 'header.php';
include_once 'lib/product.php';
$ma = $_GET['ma'];
$product = new product();
$sql = "SELECT * FROM san_pham\n\t\tWHERE id_san_pham = {$ma}";
$product->query($sql);
$row = $product->fetch();
if (isset($_POST['btn-update'])) {
    $product = new product();
    $product->set_id_sp($ma);
    $product->set_id_loai_sp($_POST['id_loai']);
    $product->set_ten_sp($_POST['ten_sp']);
    $product->set_gia_sp($_POST['gia_sp']);
    $product->set_mo_ta($_POST['mo_ta']);
    $product->set_trang_thai($_POST['trang_thai']);
    echo $product->edit_sp();
    header('location:products.php');
}
?>
	<div class="clearfix"></div><br />

	<div class="container">

		<form method='post'>

			<table class='table table-bordered'>

				<tr>
					<td><label for="id_loai" style="font-weight: normal;">ID loại sản phẩm</label></td>
开发者ID:henryroberts,项目名称:ass_inf205,代码行数:31,代码来源:edit.php

示例5:

		<div class="col-md-12">
			<table class="table table-bordered table-responsive mytable">
				<thead>
				<tr>
					<th>Mã sản phẩm</th>
					<th>Mã loại</th>
					<th>Tên sản phẩm</th>
					<th>Giá sản phẩm</th>
					<th>Mô tả</th>
					<th>Trạng thái</th>
					<th colspan="2" align="center"><center>Hành động</center></th>
				</tr>
				</thead>
				<tbody>
				<?php 
while ($row = $product->fetch()) {
    ?>
				<tr>
					<td><?php 
    echo $row['id_san_pham'];
    ?>
</td>
					<td><?php 
    echo $row['id_loai_sp'];
    ?>
</td>
					<td style="text-align: left;"><?php 
    echo $row['ten_sp'];
    ?>
</td>
					<td><?php 
开发者ID:henryroberts,项目名称:ass_inf205,代码行数:31,代码来源:products.php

示例6: product_quantity

function product_quantity()
{
    include_once 'product.php';
    $name = $_GET['product_name'];
    $obj = new product();
    if (!$obj->connect()) {
        $response = 'Not connected';
        echo $response;
        exit;
    }
    if ($obj->get_product_quantity($name)) {
        $row = $obj->fetch();
        $response = "Quantity of " . $name . " is " . $row['QUANTITY'];
        echo $response;
    } else {
        $response = 'Not Found';
        echo $response;
    }
}
开发者ID:sheamuspy,项目名称:vendite-owner,代码行数:19,代码来源:owner_function.php


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