-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.php
More file actions
34 lines (26 loc) · 809 Bytes
/
search.php
File metadata and controls
34 lines (26 loc) · 809 Bytes
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
<html><head><title>Database of all students</title></head>
<body>
<center>
<h1>Database of Students</h1>
<a href="index.php">Add students </a>
<?php
$servername = "localhost";
$username = "b160741cs";
$password = "b160741cs";
$conn = new mysqli($servername, $username, $password);
$sql = "SELECT Rollno, Name,Email, CGPA FROM db_b160741cs.user";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<table><tr><th>Roll No</th><th>Name</th><th>College</th><th>Email</th> </tr>";
while($row = $result->fetch_assoc()) {
echo "<tr><td>".$row["Rollno"]."</td><td>".$row["Name"]." ".$row["Email"]."</td><td>".$row["CGPA"]. "</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}
$conn->close();
?>
</center>
</body>
</html>