卡在ERROR报错一整天了,求大佬们帮帮忙
核心报错如图所示:
完整代码在此:
<?php
header('Content-Type:textml;charset=utf-8');
$username='游客';
//获取用户输入的账号和密码并连接数据库
$account=$_POST['account'];
$password=$_POST['password'];
$db=new mysqli('localhost','root','12345678','newsmanage');
//查询数据库是否已经有相同账号
$query1=$db->prepare("SELECT account FROM user");
$query1->bind_result($theaccount);
$query1->execute();
while($query1->fetch()) {
if ($account == $theaccount) {
echo '<script>alert("该账号已被注册!");location.href="register.html"</script>';
exit();
}
}
//将用户输入的账号和密码写入数据库
$add=$db->prepare("INSERT INTO user VALUES (null,'general',null,?,?)");
$add->bind_param('ss',$account, $password);
$add->execute();
//数据库对添加的新用户自动生成唯一ID,查寻此ID并赋值变量
$query2=$db->prepare("SELECT userid FROM user WHERE account='$account'");
$query2->bind_result($userid);
$query2->execute();
$query2->fetch();
//用username变量修改数据表中的数据
$edit=$db->prepare("UPDATE user SET username=? WHERE account=?");
$edit->bind_param('ss',$username,$account);
$edit->execute();
//报错提示:Call to a member function bind_param() on boolean in
echo '<script>alert("恭喜您,注册成功!");location.href="../login/login.html"</script>';
翻过高山走不出你