-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsearch.php
29 lines (28 loc) · 858 Bytes
/
search.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
<?php
$con = mysqli_connect('localhost', 'root', '', 'payment');
$out = '';
$sql = "SELECT * FROM student WHERE username LIKE '%" . $_POST['search'] . "%'";
$run_sql = mysqli_query($con, $sql);
if (mysqli_num_rows($run_sql) > 0) {
?>
<ul>
<img src="./images/loading.gif" alt="loading animation" align='center'
style='width: 20px;height: 20px;margin: 0 auto'>
<?php
while ($row = mysqli_fetch_array($run_sql)) {
$id = $row['id_student'];
$user_name = $row['username'];
?>
<li class="" id="element">
<a href="py.php?student=<?php print $id; ?>">
<?php print $user_name; ?>
</a>
</li>
<?php
}
?>
</ul>
<?php
} else {
echo "<p class='alert alert-success red m-3'><b>" . $_POST['search'] . "</b> element is not recognized into our system </p>";
}