What's wrong with my prepared statement? How to set the two values of it? And lastly how many parameter can mysqli_stmt_bind_param() can handle?
$username = mysqli_real_escape_string($connection, $_POST['username']);
$password = mysqli_real_escape_string($connection, $_POST['password']);
$sql = mysqli_prepare($connection, "SELECT username FROM admin WHERE username = ? AND password = ?");
mysqli_stmt_bind_param($sql, 's', $username);
mysqli_stmt_bind_param($sql, 's', $password);
mysqli_stmt_execute($sql);
$count = mysqli_num_rows($sql);
if($count == 1)
{
$_SESSION['login_user'] = $username;
header("Location: AdminHome.php");
exit;
}
else
{
$msg='Username and Password didnt match';
}
mysqli_stmt_close($sql);
mysqli_close($connection);