Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- table {
- font-family: arial, sans-serif;
- border-collapse: collapse;
- width: 100%;
- }
- td, th {
- border: 1px solid #dddddd;
- text-align: left;
- padding: 8px;
- }
- tr:nth-child(even) {
- background-color: #dddddd;
- }
- </style>
- </head>
- <body>
- <table>
- <thead>
- <tr>
- <td>Name</td>
- <td>Resource</td>
- <td>Country</td>
- </tr>
- </thead>
- <tbody>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "123";
- $dbname = "gather";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error)
- {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT Name, Resource, Country FROM gather";
- $result = $conn->query($sql);
- while($row = $result->fetch_assoc())
- {
- ?>
- <tr>
- <td><?php echo $row['Name']?></td>
- <td><?php echo $row['Resource']?></td>
- <td><?php echo $row['Country']?></td>
- </tr>
- <?php
- }
- ?>
- </tbody>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement