$promote_id = $_POST['promote_id']; $num_iids = $_POST['num_iids']; $pindao_id = $_POST['pindao_id']; $ZhuyaoPic = $_POST['ZhuyaoPic']; $suluetu1 = $_POST['suluetu1']; $suluetu2 = $_POST['suluetu2']; $help_id = $_POST['help_id']; $yonghu = $_POST['yonghu']; $D_dizhi = $_POST['D_dizhi']; $gift_id = isset($_POST['gift_id']) ? $_POST['gift_id'] : 0; $tiaoyong_id = $_POST['tiaoyong_id']; if ($title == "" || $content == "") { $updateMessage = "请把信息填写完整!!"; } else { $sql = 'SELECT * FROM `article` WHERE `title`="' . $title . '" AND `id`<>"' . $id . '"'; $rs = $pdo->query($sql); $row = $rs->fetchAll(); if (count($row) == 0) { $row = array('title' => $title, 'category_id' => $category_id, 'keyword' => $keyword, 'description' => $description, 'content' => $content, 'tag' => $tag, 'promote_id' => $promote_id, 'num_iids' => $num_iids, 'pindao_id' => $pindao_id, 'ZhuyaoPic' => $ZhuyaoPic, 'suluetu1' => $suluetu1, 'suluetu2' => $suluetu2, 'help_id' => $help_id, 'yonghu' => $yonghu, 'D_dizhi' => $D_dizhi, 'tiaoyong_id' => $tiaoyong_id, 'gift_id' => $gift_id); $result = ArticleModel::model()->update(array('id' => $id), $row); if ($result > 0) { $updateMessage = "修改成功"; } else { echo $sql; $updateMessage = "修改失败"; } } else { $updateMessage = '标题 重复'; } } }
$promote_id = $_POST["promote_id"]; $num_iids = $_POST["num_iids"]; $pindao_id = $_POST["pindao_id"]; $create_time = $_POST["create_time"] = time(); $ZhuyaoPic = $_POST['ZhuyaoPic']; $suluetu1 = $_POST['suluetu1']; $suluetu2 = $_POST['suluetu2']; $help_id = $_POST['help_id']; $yonghu = $_POST['yonghu']; $D_dizhi = $_POST['D_dizhi']; $gift_id = $_POST['gift_id']; $tiaoyong_id = $_POST['tiaoyong_id']; if ($title == "" || $content == "") { $createMessage = "请把文章信息填写完整!!"; } else { $sql = 'SELECT * FROM `article` WHERE `title`="' . $title . '" AND `id`<>"' . $id . '"'; $rs = $pdo->query($sql); $row = $rs->fetchAll(); //取得所有记录 if (count($row) == 0) { $lastetId = ArticleModel::model()->create($_POST); if ($lastetId != FALSE) { $createMessage = "添加成功"; } else { $createMessage = "添加失败"; } } else { $createMessage = '标题重复!'; } } }
$sql = 'SELECT * FROM `article` WHERE `category_id`=' . $searchCategoryId . $sql_key_str . ' ORDER BY `id` DESC'; } else { $sql = 'SELECT * FROM `article` WHERE 1 ' . $sql_key_str . ' ORDER BY `id` DESC'; } $pageSize = 30; //页面大小 $count = count($pdo->query($sql)->fetchAll()); $totalPage = ceil($count / $pageSize); $init = 1; $page_len = 9; //页码个数 $max_p = $totalPage; $pages = $totalPage; $offset = $pageSize * ($page - 1); $sql = $sql . " LIMIT {$offset},{$pageSize}"; $articleArr = ArticleModel::model()->findAllBySql($sql); $page_len = $page_len % 2 ? $page_len : $pagelen + 1; //页码个数 $pageoffset = ($page_len - 1) / 2; //页码个数左右偏移量 $key = '<div class="page">'; $key .= "<span>{$page}/{$pages}</span> "; //第几页,共几页 if ($page != 1) { $key .= "<a href=\"article_manage.php?page=1" . "&searchCategoryId=" . $searchCategoryId . "&searchWord=" . urlencode($searchWord) . "\">首页</a> "; //第一页 $key .= "<a href=\"article_manage.php?page=" . ($page - 1) . "&searchCategoryId=" . $searchCategoryId . "&searchWord=" . urlencode($searchWord) . "\">上一页</a>"; //上一页 } else { $key .= "首页 "; //第一页