请问这PHP代码哪里错了??为什么不能写入数据库??
<?phprequire_once('../connect.php');//把传递过来的信息入库,在入库之前对所有信息进行校验if(!(isset($_POST['tit...
<?php
require_once('../connect.php');
//把传递过来的信息入库,在入库之前对所有信息进行校验
if(!(isset($_POST['title'])&&(!empty($_POST['title'])))){
echo "<script>alert('标题不能为空');window.location.href='article.add.php'";
}
print_r($_POST);
$title = $_POST['title'];
$author = $_POST['author'];
$description = $_POST['description'];
$content = $_POST['content'];
$datelie = time();
$insertsql = "insert into article(title,author,description,content,dateline)"
. "values('$title','$author','$description',$content','$datelie)";
if(mysql_query($insertsql)){
echo "<script>alert('文章发表成功了');window.location.href='article.add.php'</script>";
}else{
echo "<script>alert('文章发表失败!!');window.location.href='article.add.php'</script>";
}
?> 展开
require_once('../connect.php');
//把传递过来的信息入库,在入库之前对所有信息进行校验
if(!(isset($_POST['title'])&&(!empty($_POST['title'])))){
echo "<script>alert('标题不能为空');window.location.href='article.add.php'";
}
print_r($_POST);
$title = $_POST['title'];
$author = $_POST['author'];
$description = $_POST['description'];
$content = $_POST['content'];
$datelie = time();
$insertsql = "insert into article(title,author,description,content,dateline)"
. "values('$title','$author','$description',$content','$datelie)";
if(mysql_query($insertsql)){
echo "<script>alert('文章发表成功了');window.location.href='article.add.php'</script>";
}else{
echo "<script>alert('文章发表失败!!');window.location.href='article.add.php'</script>";
}
?> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询