This function is not preventing the user from creating a new user with an alreday used username or email, it doesn't show any errors but it's not working:
function UniqueErr($conn, $username, $email){
$sql = "SELECT * FROM users WHERE usersUid = ? OR usersEmail = ?;";
$stmt = mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt, $sql)){
header("location: ../signup.php?error=stmtfailed");
exit();
}
mysqli_stmt_bind_param($stmt, "ss", $username, $email);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
if ($row = mysqli_fetch_assoc($result)){
return $row;
}
else{
$result = false;
return $result;
}
mysqli_stmt_close($stmt);
};```
---------------------------------------------------------------------------------------
`if(UniqueErr($conn, $username, $email) !== false){
header("location: ../signup.php?error=uiduniqueerr");
}`