Rumah > Soal Jawab > teks badan
<?php require_once('../connect.php'); mysqli_query("set names utf-8"); //把传递过来的信息入库,在入库之前对所有的信息进行校验。 print_r($_POST); $title = $_POST['title']; $times = $_POST['times']; $source = $_POST['source']; $column = $_POST['column']; $content = $_POST['content']; $dateline = time(); if(!isset($_POST['title']) || empty($_POST['title'])) { echo "<script>alert('标题不能为空'); window.location.href='article.add.php'</script>"; }elseif(!isset($_POST['column']) || empty($_POST['column'])){ echo "<script>alert('栏目不能为空'); window.location.href='article.add.php'</script>"; }else{ $con = mysqli_connect("localhost", "root", "root", "info"); //准备SQL语句,查询用户名 $insertsql = "SELECT info FROM article WHERE title = '$title'"; //执行SQL语 $ret = mysqli_query($con,$insertsql); if (!$ret) { die('Query failed'); } } ?>
autoload2022-03-31 09:32:44
Selesaikan masalah, semak dahulu jika terdapat sebarang masalah dengan sambungan, dan kemudian semak pernyataan pertanyaan