Im new to php and mysql and ive been making a registration system with phpmyadmin. Everything works fine apart from my member added page. If i add data through phpmyadmin it shows up in my get user info page but if i try to add data on my add member page it comes up with 2 errors. Here they are:
Warning: mysqli_stmt_bind_param(): Number of elements in type definition string doesn't match number of bind variables in C:\xampp\htdocs\memberadded.php on line 56
Error Occurred
Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\xampp\htdocs\memberadded.php on line 73
Below is my member added page in which the errors are coming up. Please could you help me locate what causes them , would really appreciate it.
     <html>
    <head>
    <title>Add Student</title>
    </head>
    <body>
    <?php
    if(isset($_POST['submit'])){
    $data_missing = array();
    if(empty($_POST['username'])){
        // Adds name to array
        $data_missing[] = 'Username';
    } else {
        // Trim white space from the name and store the name
        $username = trim($_POST['username']);
    }
    if(empty($_POST['password'])){
        // Adds name to array
        $data_missing[] = 'Password';
    } else{
        // Trim white space from the name and store the name
        $password = trim($_POST['password']);
    }
       if(empty($_POST['email'])){
        // Adds name to array
        $data_missing[] = 'Email';
    } else {
        // Trim white space from the name and store the name
        $email = trim($_POST['email']);
    }
    if(empty($data_missing)){
        require_once('../mysqli_connect.php');
        $query = "INSERT INTO members (username, password, email) VALUES (?, ?, ?)";
        $stmt = mysqli_prepare($dbc, $query);
        mysqli_stmt_bind_param($stmt, "ss", $username, $password, $email);
        mysqli_stmt_execute($stmt);
        $affected_rows = mysqli_stmt_affected_rows($stmt);
        if($affected_rows == 1){
            echo 'User Entered';
            mysqli_stmt_close($stmt);
            mysqli_close($dbc);
        } else {
            echo 'Error Occurred <br />';
            echo mysqli_error();
            mysqli_stmt_close($stmt);
            mysqli_close($dbc);
        }
    } else {
        echo 'You need to enter the following data<br />';
        foreach($data_missing as $missing){
            echo "$missing<br />";
        }
    }
}
?>
<form action="http://localhost/memberadded.php" method="post">
    <b>Add a New User</b>
<p>Username:
<input type="text" name="username" size="30" value="" />
</p>
<p>Password:
<input type="password" name="password" size="30" value="" />
</p>
<p>Email:
<input type="text" name="email" size="30" value="" />
</p>
<p>
    <input type="submit" name="submit" value="Send" />
</p>
</form>
</body>
</html>
 
     
    