jun 19
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
require 'php/connect.inc.php';
|
||||
|
||||
if (isset($_GET['search_text'])) {
|
||||
$search_text = $_GET['search_text'];
|
||||
|
||||
echo '<h2>Search Results for: ' . htmlspecialchars($search_text) . '</h2>';
|
||||
|
||||
$con = mysqli_connect($mysql_host, $mysql_user, $mysql_pass);
|
||||
if (mysqli_select_db($con, $mysql_db)) {
|
||||
$query = "SELECT `name`, `surname`, `email`, `birth_day`, `birth_month`, `birth_year` FROM `globaly_accounts` WHERE `name` LIKE '" . mysqli_real_escape_string($con, $search_text) . "%'";
|
||||
$query_run = mysqli_query($con, $query);
|
||||
|
||||
if (mysqli_num_rows($query_run) > 0) {
|
||||
echo '<table border="1">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Surname</th>
|
||||
<th>Email</th>
|
||||
<th>Birth Date</th>
|
||||
</tr>';
|
||||
|
||||
while ($query_row = mysqli_fetch_assoc($query_run)) {
|
||||
$name = $query_row['name'];
|
||||
$surname = $query_row['surname'];
|
||||
$email = $query_row['email'];
|
||||
$birth_date = $query_row['birth_day'] . '.' . $query_row['birth_month'] . '.' . $query_row['birth_year'] . '.';
|
||||
|
||||
echo '<tr>
|
||||
<td>' . htmlspecialchars($name) . '</td>
|
||||
<td>' . htmlspecialchars($surname) . '</td>
|
||||
<td>' . htmlspecialchars($email) . '</td>
|
||||
<td>' . htmlspecialchars($birth_date) . '</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
} else {
|
||||
echo 'No results found.';
|
||||
}
|
||||
} else {
|
||||
echo 'Database selection failed.';
|
||||
}
|
||||
|
||||
mysqli_close($con);
|
||||
} else {
|
||||
echo 'No search text provided.';
|
||||
}
|
||||
?>
|
||||
|
||||
<style>
|
||||
h2{
|
||||
color: #15c1cb;
|
||||
}
|
||||
table {
|
||||
width: fit-content;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table, th, td {
|
||||
border: 1px solid black;
|
||||
}
|
||||
th, td {
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
}
|
||||
th {
|
||||
background-color: #f2f2f2;
|
||||
color: #15c1cb;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user