本文整理汇总了PHP中product::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP product::setId方法的具体用法?PHP product::setId怎么用?PHP product::setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类product
的用法示例。
在下文中一共展示了product::setId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: product
name="onhome" /> Pagina Inicial
<br />
<button type="submit" name="save" class="green"><?php
echo $language['save'];
?>
</button>
<button type="reset" name="cancel" class="red"><?php
echo $language['cancel'];
?>
</button>
</div>
</form>
<?php
} else {
$product = new product();
$product->setId(intval($_GET['i']));
// convert to bool the service box
if (isset($_REQUEST['service'])) {
$service = true;
} else {
$service = false;
}
// convert to bool the published box
if (isset($_REQUEST['published'])) {
$published = true;
} else {
$published = false;
}
// convert to bool the onhome box
if (isset($_REQUEST['onhome'])) {
$onhome = true;
示例2: getProductByGroup
public function getProductByGroup($id = NULL)
{
if ($id) {
$stmt = $this->pdo->PDOInstance->prepare("SELECT * FROM product as p WHERE p.id_group = :id");
$stmt->bindParam(':id', $id);
} else {
$stmt = $this->pdo->PDOInstance->prepare("SELECT * FROM product as p");
}
try {
$stmt->execute();
} catch (Exception $e) {
echo "Problem at " . $e->getLine() . " from model Extraction :" . $e->getMessage();
}
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($id) {
$result_group = $this->getGroup($id);
} else {
$result_group = $this->getGroup();
}
foreach ($result as $product) {
$product_ = new product();
$product_->setId($product["id"]);
$product_->setRef($product["ref"]);
$product_->setName($product["name"]);
$product_->setDescription($product["description"]);
$product_->setCost($product["cost"]);
$product_->setPrice($product["price"]);
$product_->setUnit($product["unit"]);
$product_->setId_group($product["id_group"]);
$indice = 0;
foreach ($result_group as $group) {
if ($group->getId() == $product_->getId_group()) {
$result_group[$indice]->addProduct($product_);
}
$indice++;
}
}
return $result_group;
}
示例3: product
<?php
if (isset($_REQUEST['i']) && !empty($_REQUEST['i'])) {
$product = new product();
$product->setId($_REQUEST['i']);
if ($product->delete()) {
print 'sucess';
} else {
print 'error';
}
} else {
print 'error';
}