Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "student";
- $password = "robertson";
- $dbname = "teams";
- $conn = new mysqli (
- $servername,
- $username,
- $password,
- $dbname
- );
- if ($conn->connect_error) {
- die("Oops! Couldn't connect: " . $conn->connect_error);
- }
- $sql = "SELECT name, phone FROM tbStudent";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // Create table
- echo "<table style=\"border: 1px solid; text-align: center;\"><tr><th width=\"140px;\">Name</th><th width=\"140px;\">Phone</th></tr>";
- while ($row = $result->fetch_assoc()) {
- echo "<tr><td>" .$row["name"]. "</td><td>" .$row["phone"]. "</td></tr>";
- }
- // Close the table
- echo "</table>";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement