PHP cannot modify database data

the card has been wrong in ERROR all day. Ask the bosses for help.
the core error report is shown in the figure:

the complete code is here:

<?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();
//IDID
$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>";
Mar.14,2021
The

error message makes it clear that you used a member function for a Bool value. The
error message indicates that your $db- > prepare () method failed and returned false, instead of the mysqli_stmt object.
make sure that $db is connected correctly and that the name of the table field involved in the sql in the prepare method is incorrect. And other issues that I can't think of for the time being.

Menu