I'm trying to figure out why my code isn't working. I'm getting the "Call to a member function execute() on boolean " which should indicate i'm making an SQL error mistake. Though i'm not sure what it is. I have been looking at other posts, but they haven't been quite useful for me. Sorry if it's a duplicate.
if(isset($_POST["signup"])) {
$username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING)
or die('Error: missing username');
$email = filter_input(INPUT_POST, 'email')
or die('Error: missing email');
$password = filter_input(INPUT_POST, 'password')
or die('Error: missing password');
$sql = $db->prepare('SELECT username, email FROM wyvern_user WHERE
username=?, email=?');
$sql->execute();
$sql->bind_result($username, $email);
while($stmt->fetch()) {
if($username && $email > 1) {
echo "User Already in Exists<br/>";
} else {
$query = $db->prepare("INSERT INTO wyvern_user (username, email, password)
VALUES(?, ?, ?)");
$query->bind_param('sss', $username, $email, $password);
$query->execute();
echo "Account created";}
}
}
Here is my form aswell, if it makes a difference.
<form class="theform" action="signup.php" method="post">
<p>Register as user:</p><br>
Username<span>*</span><input type="text" name="username" value=""
placeholder="username"><br><br>
Email<span>*</span> <input type="email" name="email" value=""
placeholder="email"><br><br>
Password<span>*</span><input type="password" name="password"
value="" placeholder="password"><br><br>
<input type="submit" name="signup" value="signup"><br><br>
</form>