-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSameGenQ.php
47 lines (32 loc) · 1.23 KB
/
SameGenQ.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
session_start();
?>
<div style="width: 980px;margin-bottom: 10px" id="results-container">
<?php
// Database connection
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "identical-gen";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Search query
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$searchTerm = $conn->real_escape_string($_POST["date"]);
$sql = "SELECT * FROM samegen WHERE day LIKE '%$searchTerm%' OR month LIKE '%$searchTerm%' OR year LIKE '%$searchTerm%'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo '<p><strong>' . $row["day"] . '</strong><br>' . $row["month"] . '<br>' . $row["year"] . '</p>';
}
} else {
echo '<p>No results found.</p>';
}
}
// Close the database connection
$conn->close();
?>
</div>
</div></center>