php插入数据,但是数据库里没有 显示任何数据 5
<?phpsession_start();include_once'conn.php';$ndate=date("Y-m-d");$addnew=$_POST["addn...
<?php
session_start();
include_once 'conn.php';
$ndate =date("Y-m-d");
$addnew=$_POST["addnew"];
if ($addnew=="1")
{
$Nid=$_POST["Nid"];
$Ntitle=$_POST["Ntitle"];
$content=$_POST["content"];
$fbDate=$_POST["fbDate"];
$fbPerson=$_POST["fbPerson"];
$sql="select Ntitle from notice where Ntitle='$Ntitle'";
$query=mysql_query($sql);
$rowscount=mysql_num_rows($query);
if($rowscount>0)
{
echo "<script language='javascript'>alert('该公告已经存在!');history.back();</script>";
}else{
$sql="insert into notice(Nid,Ntitle,content,fbDate,fbPerson)
values('$Nid ','$Ntitle','$content','$fbDate','$fbPerson') ";
mysql_query($sql);
echo "<script>javascript:alert('添加成功!');location.href='notice_add.php';</script>";
}
}
?> 展开
session_start();
include_once 'conn.php';
$ndate =date("Y-m-d");
$addnew=$_POST["addnew"];
if ($addnew=="1")
{
$Nid=$_POST["Nid"];
$Ntitle=$_POST["Ntitle"];
$content=$_POST["content"];
$fbDate=$_POST["fbDate"];
$fbPerson=$_POST["fbPerson"];
$sql="select Ntitle from notice where Ntitle='$Ntitle'";
$query=mysql_query($sql);
$rowscount=mysql_num_rows($query);
if($rowscount>0)
{
echo "<script language='javascript'>alert('该公告已经存在!');history.back();</script>";
}else{
$sql="insert into notice(Nid,Ntitle,content,fbDate,fbPerson)
values('$Nid ','$Ntitle','$content','$fbDate','$fbPerson') ";
mysql_query($sql);
echo "<script>javascript:alert('添加成功!');location.href='notice_add.php';</script>";
}
}
?> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |