php insert into语句一直不执行 为什么?
<?php$conn=mysqli_connect("localhost","root","","jiakao")ordie("数据库连接错误");mysqli_quer...
<?php
$conn=mysqli_connect("localhost","root","","jiakao")or die("数据库连接错误");
mysqli_query($conn,"set names utf8");
if(isset($_POST["submit"]))
{
$sqli="SELECT * FROM `l-guan` WHERE namel='$_POST[mz]'";
$query=mysqli_query($conn,$sqli);
$num=mysqli_num_rows($query);
if($num)
{
echo"<script language='javascript'>alert('该管理员已存在')</script>";
}
else
{
"INSERT INTO `shq`(`xu`,`mz`,`mima`,`reason`)VALUES('','$_POST[mz]','$_POST[mima]','$_POST[reason]')";
echo"<script language='javascript'>alert('申请成功 请耐心等待审核')</script>";
echo"<script language='javascript'>location.href=('shouye.php');</script>";
}
}
?>
<body>
<div class="header">
<a href="#">
</a>
<p>
</div>
<div class="row-fluid login-wrapper">
<div class="box">
<div class="content-wrap">
<h6><font face="微软雅黑">管 理 员 申 请</font></h6>
<form action="signup.php" method="post" name="sq" onsubmit="return check()">
<input name="mz" class="span12" type="text" placeholder="用户名" />
<input name="mima" class="span12" type="password" placeholder="输入密码" />
<input name="remima" class="span12" type="password" placeholder="确认密码" />
<input name="reason" class="span12" type="text" placeholder="申请理由" />
<input name="submit" type="submit" value="提交申请">
</div>
</div>
<div class="span4 already">
<a href="signin.php"><font face="微软雅黑">登 录</font></a>
<a href="shouye.php"><font face="微软雅黑">返回首页</font></a>
</div>
</div>
</form> 展开
$conn=mysqli_connect("localhost","root","","jiakao")or die("数据库连接错误");
mysqli_query($conn,"set names utf8");
if(isset($_POST["submit"]))
{
$sqli="SELECT * FROM `l-guan` WHERE namel='$_POST[mz]'";
$query=mysqli_query($conn,$sqli);
$num=mysqli_num_rows($query);
if($num)
{
echo"<script language='javascript'>alert('该管理员已存在')</script>";
}
else
{
"INSERT INTO `shq`(`xu`,`mz`,`mima`,`reason`)VALUES('','$_POST[mz]','$_POST[mima]','$_POST[reason]')";
echo"<script language='javascript'>alert('申请成功 请耐心等待审核')</script>";
echo"<script language='javascript'>location.href=('shouye.php');</script>";
}
}
?>
<body>
<div class="header">
<a href="#">
</a>
<p>
</div>
<div class="row-fluid login-wrapper">
<div class="box">
<div class="content-wrap">
<h6><font face="微软雅黑">管 理 员 申 请</font></h6>
<form action="signup.php" method="post" name="sq" onsubmit="return check()">
<input name="mz" class="span12" type="text" placeholder="用户名" />
<input name="mima" class="span12" type="password" placeholder="输入密码" />
<input name="remima" class="span12" type="password" placeholder="确认密码" />
<input name="reason" class="span12" type="text" placeholder="申请理由" />
<input name="submit" type="submit" value="提交申请">
</div>
</div>
<div class="span4 already">
<a href="signin.php"><font face="微软雅黑">登 录</font></a>
<a href="shouye.php"><font face="微软雅黑">返回首页</font></a>
</div>
</div>
</form> 展开
展开全部
$sql = "INSERT INTO `shq`(`xu`,`mz`,`mima`,`reason`)VALUES('','$_POST[mz]','$_POST[mima]','$_POST[reason]')";
mysqli_query($sql);
更多追问追答
追问
$sql="INSERT INTO `shq`(`xu`,`mz`,`mima`,`reason`)VALUES('','$_POST[mz]','$_POST[mima]','$_POST[reason]')";
mysqli_query($conn,$sql);
还是没有放进数据库里 大神 求帮忙。
追答
第一个括号里面内容引号去掉
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询