本文整理汇总了PHP中post::create方法的典型用法代码示例。如果您正苦于以下问题:PHP post::create方法的具体用法?PHP post::create怎么用?PHP post::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类post
的用法示例。
在下文中一共展示了post::create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
<?php
date_default_timezone_set("Asia/Manila");
$date = date('Y-m-d H:i:s');
if (isset($_POST['btnpost'])) {
include_once "post.php";
$param = array("postTitle" => $_POST["title"], "postDesc" => $_POST["desc"], "userID" => $_SESSION['id'], "topicID" => $_GET['topicid'], "datePosted" => $date, "postStatus" => 1, "postLevel" => $_SESSION['level']);
$query = new post();
$query->create("tblpost", $param);
}
if (isset($_POST['btntopic'])) {
include_once "topic.php";
$param = array("topicTitle" => $_POST["title"], "topicDesc" => $_POST["content"], "dateCreated" => $date, "forumCatID" => $_POST["cbocategory"], "topicStatus" => 1);
$query = new topic();
$query->create("tbltopic", $param);
}
if (isset($_POST['btnreply'])) {
include_once "post.php";
$param = array("replyContent" => $_POST["message"], "postID" => $_GET["postid"], "userID" => $_SESSION["id"], "datePosted" => $date, "replyLevel" => $_SESSION["level"], "replyStatus" => 1);
$query = new post();
$query->add("tblreply", $param);
}
示例2: ucfirst
<?php
require "../../includes/conf.inc.php";
require "../../includes/functions.inc.php";
if (isset($_POST['postTitle'])) {
$adminId = $_SESSION['adminId'];
$postTitle = $_POST['postTitle'];
$postTypId = $_POST['postTypId'];
$subjectId = $_POST['subjectId'];
$imp = $_POST['imp'];
$postText = $_POST['postText'];
$postTitle = ucfirst(sanitize_text($postTitle));
$postText = trim(mysql_real_escape_string(stripslashes($postText)));
if ($postTitle == '' || $postText == '') {
//when any entry is empty
$response = array('success' => 0, 'error' => 1, 'errorMsg' => 'Either Post Title Or Post Body is empty!');
} else {
$newPost = array('postTitle' => $postTitle, 'postText' => $postText, 'subjectId' => $subjectId, 'postTypId' => $postTypId, 'adminId' => $adminId, 'statusId' => 2, 'imp' => $imp);
if (!post::create($newPost)) {
$response = array('success' => 0, 'error' => 2, 'errorMsg' => 'Opps! Something Went Wrong!');
} else {
$response = array('success' => 1, 'error' => 0);
}
}
/*$_SESSION['response'] = $response;
header("location: add.php");*/
echo json_encode($response);
}