php和数据库连接成功 但无法插入数据 200
<?phpheader("Content-Type:text/html;charset=utf8");$link=mysqli_connect('127.0.0.1','...
<?php
header("Content-Type: text/html; charset=utf8");
$link = mysqli_connect('127.0.0.1', 'root', '111447', 'test');
//$username = $_POST["username"];
//$password = $_POST["password"];
//$pwd = $_POST["pwd"];
//$tel = $_POST["tel"];
//$email = $_POST["email"];
//$qq = $_POST["qq"];
//$yzm = $_POST["yzm"];
if (!$link) {
die('Could not connect: ' . mysql_error());
}else {
if (isset($_POST['submit'])){
if($_POST['username']==""||$_POST['password']==""||$_POST['pwd']==""){
echo "<script>alert('请输入用户名或密码!');history.go(-1);</script>";
}else
if($_POST['username']==""||$_POST['password']==""||$_POST['pwd']==""||$_POST['tel']==""||$_POST['email']==""||$_POST['qq']==""||$_POST['yzm']==""){
echo "<script>alert('请输入完整信息!');history.go(-1);</script>";
}else
if ($_POST['password'] == $_POST['pwd']){
$query = "insert into register(username,password,pwd,tel,email,qq,yzm) values('{$_POST['username']}','{$_POST['password']}','{$_POST['pwd']}','{$_POST['tel']}','{$_POST['email']}','{$_POST['qq']}','{$_POST['yzm']}')";
$result=mysqli_query($link, $query);
header("Location:login.html");
}else {
echo "<script>alert('两次输入密码不一致!');history.go(-1);</script>";
}
}
}
?> 展开
header("Content-Type: text/html; charset=utf8");
$link = mysqli_connect('127.0.0.1', 'root', '111447', 'test');
//$username = $_POST["username"];
//$password = $_POST["password"];
//$pwd = $_POST["pwd"];
//$tel = $_POST["tel"];
//$email = $_POST["email"];
//$qq = $_POST["qq"];
//$yzm = $_POST["yzm"];
if (!$link) {
die('Could not connect: ' . mysql_error());
}else {
if (isset($_POST['submit'])){
if($_POST['username']==""||$_POST['password']==""||$_POST['pwd']==""){
echo "<script>alert('请输入用户名或密码!');history.go(-1);</script>";
}else
if($_POST['username']==""||$_POST['password']==""||$_POST['pwd']==""||$_POST['tel']==""||$_POST['email']==""||$_POST['qq']==""||$_POST['yzm']==""){
echo "<script>alert('请输入完整信息!');history.go(-1);</script>";
}else
if ($_POST['password'] == $_POST['pwd']){
$query = "insert into register(username,password,pwd,tel,email,qq,yzm) values('{$_POST['username']}','{$_POST['password']}','{$_POST['pwd']}','{$_POST['tel']}','{$_POST['email']}','{$_POST['qq']}','{$_POST['yzm']}')";
$result=mysqli_query($link, $query);
header("Location:login.html");
}else {
echo "<script>alert('两次输入密码不一致!');history.go(-1);</script>";
}
}
}
?> 展开
10个回答
展开全部
去找专业人员解决
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |