-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsearchResults.php
66 lines (57 loc) · 2.24 KB
/
searchResults.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
include "config.php";
$name = $_POST['name'];
?>
<!DOCTYPE html>
<html>
<head>
<title>Edit Menu</title>
<link rel="stylesheet" href="styles/style.css">
</head>
<body>
<div class = "container">
<div class="buttons">
<button><a href="index.php">View</a></button>
</div>
<div class = "editdetails box results">
<div class = "border">
<table>
<tr>
<th>Student ID</th><th>Student Name</th><th>Student Age</th><th>Student Address</th><th>Image</th>
</tr>
<?php
$sql = "SELECT * FROM student WHERE studentName LIKE '%$name%'";
$result = $conn->query($sql);
if ($result -> num_rows > 0)
{
while($row = $result->fetch_assoc())
{
$id = $row['studentID'];
$name = $row['studentName'];
$age = $row['studentAge'];
$address = $row['studentAddress'];
$image = $row['imgLoc'];
echo '<tr><td>'.$id.'</td><td>'.$name.'</td><td>'.$age.'</td><td>'.$address.'</td>';
if ($image == NULL)
{
echo '<td><h4>No<br>Image</h4></td></tr>';
}
else
{
echo'<td>';
echo'<img src="'.$image.'" alt="" style = "width:50px; height:50px; margin-top:5px;">';
echo'</td></tr>';
}
}
}
else
{
echo '<p>No Search Results</p>';
}
?>
</table>
</div>
</div>
</div>
</body>
</html>