<?php require "data_operate.php"; if ($_REQUEST['operate_type'] === "insert") { //创建操作对象 $request = new insert_data($_REQUEST['news_title'], $_REQUEST['news_title_pic'], $_REQUEST['news_content'], $_REQUEST['news_add_time'], $_REQUEST['news_author'], $_REQUEST['table_name']); //连接数据库 $request->connect_database(); //执行sql代码 $request->query(); //查询并返回最新状态 echo $request->select_new_data(); //关闭数据库连接 $request->close(); }
if (!isset($_POST['jiemu'])) { $jiemu = 0; } else { $jiemu = intval($_POST['jiemu']); } if (!isset($_POST['score'])) { $score = 0; } else { $score = $_POST['score']; } //echo $score; if ($score > $score_zhidu || $score < 0) { echo "<h2 align='center'>数值不正确!请重新评分。</h2>"; } else { if ($pingwei != 'null' && $jiemu != 0) { $insert_score = new insert_data($pingwei, $jiemu, $score); $insert_score->update(); } } //echo $jiemu,$pingwei,$score; class insert_data { private $pingwie; private $jiemu; private $score; function __construct($pingwei_id, $jiemu_id, $jiemu_score) { $this->pingwei = $pingwei_id; $this->score = $jiemu_score; $this->jiemu = $jiemu_id; //echo $this->pingwei,$this->jiemu,$this->score;