本文整理汇总了PHP中product::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP product::insert方法的具体用法?PHP product::insert怎么用?PHP product::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类product
的用法示例。
在下文中一共展示了product::insert方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: time
$path = '../../images/products/' . $_POST['cNames_menu_edit'] . '/' . $_POST['scNames_menu_edit'] . '/' . time() . '.' . $type[1];
// echo $type
// $allowed_types = array('image/png','image/jpg','image/jpeg');
// if(!in_array($type,$allowed_types))
// {
// echo 'plz, upload image type';
// }
// else if($size > 42565433)
// {
// echo 'plz, dun exceed the max limit of size';
// }
// else
// {
move_uploaded_file($tmp_name, $path);
chmod($path, 0777);
// echo "<img src='images/$name'/>";
// }
$products = new product();
$products->pName = $_POST['insert_pName'];
$products->scID = $_POST['scNames_menu_edit'];
$products->pPrice = $_POST['insert_pPrice'];
$products->pQuantity = $_POST['insert_pQuantity'];
$products->pImg = $path;
$products->pDesc = $_POST['insert_pDesc'];
$id = $products->insert();
} else {
$_SESSION['errors'] = $arrErrors;
}
header("Location: adminProducts.php");
exit;
}
示例2:
//echo $pid;
$subType_id = $_POST['scatname'];
$pname = $_POST['pname'];
$desc = $_POST['desc'];
$quantity = $_POST['quantity'];
$price = $_POST['price'];
//$date=date("d/m/y");
$pdate = $_POST['pdate'];
//$pdate=now();
//$pdate=strtotime('$pd','%d-%m-%Y');
$product_img = $_FILES['image']['tmp_name'];
$imgname = $_FILES['image']['name'];
$type = $_FILES['image']['type'];
if (in_array($type, array('image/jpeg', 'image/png', 'image/jpg', 'image/gif'))) {
move_uploaded_file($product_img, "../images/items/{$imgname}");
$p = $product->insert($pname, $desc, $quantity, $imgname, $subType_id, $price, $pdate);
}
//header("location:addProduct.php");
}
}
include 'Aheader.php';
?>
<form action="addProduct.php" enctype="multipart/form-data" method="post">
<div id="inside">
<div class="container">
<div class="row">
<div class="col-md-9 personal-info">
<table class="table table-bordered table-hover table-striped table-responsive">
<tr><th colspan="3"><h2>Add new product</h2></th></tr>
<tr>
示例3: product
$_REQUEST['onhome'] = false;
}
$product = new product();
$product->setReference($_REQUEST['reference']);
$product->setContent($_REQUEST['title_1'], $_REQUEST['content_1'], $_REQUEST['title_2'], $_REQUEST['content_2'], $_REQUEST['title_3'], $_REQUEST['content_3'], $_REQUEST['title_4'], $_REQUEST['content_4'], $_REQUEST['title_5'], $_REQUEST['content_5'], $_REQUEST['title_6'], $_REQUEST['content_6'], $_REQUEST['code']);
$product->setService($_REQUEST['service']);
$product->setPrice($_REQUEST['price']);
$product->setVAT($_REQUEST['vat']);
$product->setDiscount($_REQUEST['discount']);
$product->setUserId($account['name']);
$product->setCategory($_REQUEST['category']);
$product->setDate();
$product->setDateUpdate();
$product->setPublished($_REQUEST['published']);
$product->setonHome($_REQUEST['onhome']);
if ($product->insert()) {
print 'sucess';
$id = $mysqli->insert_id;
?>
<div class="separator30"></div>
<span id="label">Lista de ficheiros</span>
<?php
print returnFilesList($id, 'product');
?>
<div class="separator30"></div>
<?php
print returnImgUploader('IMG Uploader', $id, 'product', '290', 350);
print ' ';