mysqlinsertphp
if($action == 'insert'){ //受信データ据 $title = empty($_POST['subject']) ? '' : $_POST['件名']; $content = empty($_POST['content']) ? '' : $_POST['コンテンツ']; $user_id = $_SESSION['myuser']['id']; $create_ad = 時間(); $summary = empty($_POST['summary']) ? '' : $_POST['要約']; $category_id = 空($_POST['category_id']) ? '' : $_POST['category_id']; $cover = empty($_POST['cover']) ? 'mr.jpg' : $_POST['カバー']; $state = empty($_POST['submit']) ? '' : $_POST['送信']; $is_delete = 0; $tags = ''; //验证 if($category_id == '' || $title == '' || $content = '' || $summary == ''){ header('refresh : 2 ; url = Article.php?a =追加'); echo '入力の情報あり、请再入力'; 出口; } //入库 $sql = "INSERT INTO tn_article
VALUES(null, '$title','$content', $user_id, $create_ad, '$summary', $category_id, '$cover', '$state '、'$is_delete'、'$tags')"; //获取页面 if($dao ->query($sql)){ header('location:article.php?a=list'); 出口; } else{ header('refresh : 2; url =article.php?a=add'); echo '追加失败'; 出口; }}