// Establish a database connection (Assuming you have already connected to your database) | |
// Assuming the username is obtained from a form submission | |
$username = $_POST['username']; // Replace this with your actual way of obtaining the username | |
// Perform the query to check if the user with the given username has a non-null mean | |
$query = "SELECT username, mean FROM users WHERE username = '$username' AND mean IS NOT NULL"; | |
$result = mysqli_query($connection, $query); // Assuming you are using mysqli | |
// Check if the query returned any rows | |
if (mysqli_num_rows($result) > 0) { | |
// User with non-null mean found | |
header('Location: a.html'); // Redirect to a.html if mean is not null | |
} else { | |
// User not found or mean is null | |
header('Location: b.html'); // Redirect to b.html if mean is null or user not found | |
} | |
// Close the database connection | |
mysqli_close($connection); // Assuming you are using mysqli | |