Create But2.php
Browse files
But2.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Establish a database connection (Assuming you have already connected to your database)
|
3 |
+
|
4 |
+
// Assuming the username is obtained from a form submission
|
5 |
+
$username = $_POST['username']; // Replace this with your actual way of obtaining the username
|
6 |
+
|
7 |
+
// Perform the query to check if the user with the given username has a non-null mean
|
8 |
+
$query = "SELECT username, mean FROM users WHERE username = '$username' AND mean IS NOT NULL";
|
9 |
+
$result = mysqli_query($connection, $query); // Assuming you are using mysqli
|
10 |
+
|
11 |
+
// Check if the query returned any rows
|
12 |
+
if (mysqli_num_rows($result) > 0) {
|
13 |
+
// User with non-null mean found
|
14 |
+
header('Location: a.html'); // Redirect to a.html if mean is not null
|
15 |
+
} else {
|
16 |
+
// User not found or mean is null
|
17 |
+
header('Location: b.html'); // Redirect to b.html if mean is null or user not found
|
18 |
+
}
|
19 |
+
|
20 |
+
// Close the database connection
|
21 |
+
mysqli_close($connection); // Assuming you are using mysqli
|
22 |
+
?>
|