Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = "localhost";
- $username = "root";
- $password = "";
- $dbname = "tech_project";
- $conn = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
- //* Check connection
- if (mysqli_connect_errno())
- {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }
- $result = mysqli_query($conn,"SELECT * FROM emp_details");
- echo "<table border='1'>
- <tr>
- <th>Name</th>
- <th>Email</th>
- <th>Gender</th>
- <th>Address</th>
- <th>City</th>
- </tr>";
- while($row = mysqli_fetch_array($result))
- {
- echo "<tr>";
- echo "<td>" . $row['name'] . "</td>";
- echo "<td>" . $row['email'] . "</td>";
- echo "<td>" . $row['gender'] . "</td>";
- echo "<td>" . $row['address'] . "</td>";
- echo "<td>" . $row['city'] . "</td>";
- echo "</tr>";
- }
- echo "</table>";
- mysqli_close($conn);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement