本文整理汇总了PHP中category::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP category::insert方法的具体用法?PHP category::insert怎么用?PHP category::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类category
的用法示例。
在下文中一共展示了category::insert方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: category
<?php
include 'categoryclass.php';
if (isset($_POST['Add'])) {
if (!empty(trim($_POST['catname']))) {
$name = $_POST['catname'];
$categ = new category();
$categ->insert($name);
}
}
include 'header1.php';
?>
<form action="addcategory.php" method="post">
<div id="inside">
<div class="container">
<div class="row">
<table class="table table-bordered table-hover table-striped table-responsive">
<tr><th colspan="2"><h2>Add new category</h2></th></tr>
<tr>
<th>category name</th>
<td><input type="text" name="catname"/></td>
</tr>
<tr>
<td></td>
<td id="submit"><input type="submit" name="Add" value="Add" ></td>
</tr>
</table>
</form>
<br/>
示例2:
if (empty(trim($_GET['name']))) {
$errors[] = "the name is empty";
$_SESSION['errors'] = $errors;
}
if ($category->category_is_exist($_GET['name'])) {
$errors[] = "the category is already exist";
$_SESSION['errors'] = $errors;
}
if (empty(trim($_GET['desc']))) {
$errors[] = "the desc is empty";
$_SESSION['errors'] = $errors;
}
if (empty($errors)) {
$category->category_name = $_GET['name'];
$category->category_desc = $_GET['desc'];
$category->insert();
}
$data = $category->getallcategory();
$response1 = [];
$response1[] = $data;
$response1[] = $errors;
$jsondata = json_encode($response1);
echo $jsondata;
// $category = new category();
// $category->category_name = $_GET['name'];
// $category->category_desc = $_GET['desc'];
// $category->insert();
// $data = $category->getallcategory();
// $jsondata = json_encode($data);
// echo $jsondata;
} else {
示例3: category
<button type="reset" name="cancel" class="red"><?php
echo $language['cancel'];
?>
</button>
</div>
</form>
<?php
} else {
if (isset($_REQUEST['published'])) {
$_REQUEST['published'] = true;
} else {
$_REQUEST['published'] = false;
}
$object_category = new category();
$object_category->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']);
$object_category->setUserId($account["name"]);
$object_category->setDate();
$object_category->setDateUpdate();
$object_category->setPublished($_REQUEST['published']);
$object_category->setCategoryType($_REQUEST['section']);
if ($object_category->insert()) {
print 'sucess';
} else {
print 'failure';
}
}
?>
</div>