Advertisement
Guest User

Untitled

a guest
Jul 19th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. table {
  6. font-family: arial, sans-serif;
  7. border-collapse: collapse;
  8. width: 100%;
  9. }
  10.  
  11. td, th {
  12. border: 1px solid #dddddd;
  13. text-align: left;
  14. padding: 8px;
  15. }
  16.  
  17. tr:nth-child(even) {
  18. background-color: #dddddd;
  19. }
  20. </style>
  21. </head>
  22. <body>
  23. <table>
  24. <thead>
  25. <tr>
  26. <td>Name</td>
  27. <td>Resource</td>
  28. <td>Country</td>
  29. </tr>
  30. </thead>
  31. <tbody>
  32. <?php
  33. $servername = "localhost";
  34. $username = "root";
  35. $password = "123";
  36. $dbname = "gather";
  37.  
  38. // Create connection
  39. $conn = new mysqli($servername, $username, $password, $dbname);
  40. // Check connection
  41. if ($conn->connect_error)
  42. {
  43. die("Connection failed: " . $conn->connect_error);
  44. }
  45. $sql = "SELECT Name, Resource, Country FROM gather";
  46. $result = $conn->query($sql);
  47.  
  48. while($row = $result->fetch_assoc())
  49. {
  50. ?>
  51. <tr>
  52. <td><?php echo $row['Name']?></td>
  53. <td><?php echo $row['Resource']?></td>
  54. <td><?php echo $row['Country']?></td>
  55. </tr>
  56. <?php
  57. }
  58. ?>
  59. </tbody>
  60. </table>
  61.  
  62. </body>
  63. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement