Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Student Records</title>
- </head>
- <body>
- <?php
- $conn = mysqli_connect("localhost", "root", "", "COLLEGE");
- if ($conn->connect_error) {
- die("Connection Failed: " . $conn->connect_error);
- }
- echo "Connected successfully<br>";
- $sql = "SELECT SID, NAME, EMAIL, FEES, DOB FROM STUDENT";
- $result = mysqli_query($conn, $sql);
- if (mysqli_num_rows($result) > 0) {
- // Output data for each row
- echo "<table border='1'>
- <tr>
- <th>ID</th>
- <th>NAME</th>
- <th>EMAIL</th>
- <th>FEES</th>
- <th>DOB</th>
- </tr>";
- while ($row = mysqli_fetch_assoc($result)) {
- echo "<tr>
- <td>" . $row["SID"] . "</td>
- <td>" . $row["NAME"] . "</td>
- <td>" . $row["EMAIL"] . "</td>
- <td>" . $row["FEES"] . "</td>
- <td>" . $row["DOB"] . "</td>
- </tr>";
- }
- echo "</table>"; // Closing table tag was missing
- } else {
- echo "0 results";
- }
- $conn->close();
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement