Need Help to fix the error

Hello i need help i have follow Warning =
Warning : mysqli_stmt_bind_param(): Number of variables doesn’t match number of parameters in prepared statement in D:\XAMPP\htdocs\gameinfo.php on line 30

i need the ‘Succsess’ msg

/////// Need to Grab Username And Password
$username = $_GET[“username”];
$password = $_GET[“password”];
// create a prepared statement
$stmt = mysqli_prepare($mysqli, “SELECT username, password, regkey, banned FROM users WHERE username=’$username’”);

// bind parameters
mysqli_stmt_bind_param ($stmt,‘s’,$username); <—(( Line 30 ))

// execute query
mysqli_stmt_execute($stmt);

// bind result variables
mysqli_stmt_bind_result($stmt, $username, $hashed_password, $regkey, $banned);

// fetch value
mysqli_stmt_fetch($stmt);

if(password_verify($password, $hashed_password)){
echo json_encode(array(‘result’ => ‘success’, ‘regkey’ => $regkey, ‘banned’ => $banned));
}else{
// incorrect password
}

mysqli_stmt_close($stmt);

$mysqli->close();

You didnt prepare your statement with a placeholder, just look it up in the manual. Doing it right would also prevent anybody from deleting your complete database.

1 Like
Sponsor our Newsletter | Privacy Policy | Terms of Service