Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "jit123";
- $dbname = "1JT14CS023db3";
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error)
- {
- die("connection failed: " . $conn->connect_error);
- }
- else
- {
- $sqlQuery = "select * from student";
- $result = $conn->query($sqlQuery);
- if($result->num_rows > 0)
- {
- echo "<table align=\"center\"border=1><tr><th>student regno</th>";
- echo "<th>Student Name</th>";
- echo "<th>major</th>";
- echo "<th>DOB</th>";
- echo "</tr>";
- while($row = $result->fetch_assoc())
- {
- echo"<tr>";
- echo "<td>$row[regno]</td>";
- echo"<td>$row[name]</td>";
- echo"<td>$row[major]</td>";
- echo"<td>$row[bdate]</td>";
- echo "</tr>";
- }
- echo "</table>";
- }
- else
- echo"Empty set";
- }
- $conn->close();
- ?>
Add Comment
Please, Sign In to add comment