Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. <style>
  2. table {
  3. width: 750px;
  4. border-collapse: collapse;
  5. margin:50px auto;
  6. }
  7.  
  8. /* Zebra striping */
  9. tr:nth-of-type(odd) {
  10. background: #eee;
  11. }
  12.  
  13. th {
  14. background: #3498db;
  15. color: white;
  16. font-weight: bold;
  17. }
  18.  
  19. td, th {
  20. padding: 10px;
  21. border: 1px solid #ccc;
  22. text-align: left;
  23. font-size: 18px;
  24. }
  25.  
  26. /*
  27. Max width before this PARTICULAR table gets nasty
  28. This query will take effect for any screen smaller than 760px
  29. and also iPads specifically.
  30. */
  31. @media
  32. only screen and (max-width: 760px),
  33. (min-device-width: 768px) and (max-device-width: 1024px) {
  34.  
  35. table {
  36. width: 100%;
  37. }
  38.  
  39. /* Force table to not be like tables anymore */
  40. table, thead, tbody, th, td, tr {
  41. display: block;
  42. }
  43.  
  44. /* Hide table headers (but not display: none;, for accessibility) */
  45. thead tr {
  46. position: absolute;
  47. top: -9999px;
  48. left: -9999px;
  49. }
  50.  
  51. tr { border: 1px solid #ccc; }
  52.  
  53. td {
  54. /* Behave like a "row" */
  55. border: none;
  56. border-bottom: 1px solid #eee;
  57. position: relative;
  58. padding-left: 50%;
  59. }
  60.  
  61. td:before {
  62. /* Now like a table header */
  63. position: absolute;
  64. /* Top/left values mimic padding */
  65. top: 6px;
  66. left: 6px;
  67. width: 45%;
  68. padding-right: 10px;
  69. white-space: nowrap;
  70. /* Label the data */
  71. content: attr(data-column);
  72.  
  73. color: #000;
  74. font-weight: bold;
  75. }
  76.  
  77. }
  78.  
  79. </style>
  80.  
  81. <table>
  82. <tr>
  83. <th>
  84. Nama siswa
  85. </th>
  86. <th>
  87. Kata Sandi
  88. </th>
  89. </tr>
  90. <?php
  91.  
  92. $servername = "localhost";
  93. $database = "sekolah";
  94. $username = "root";
  95. $password = "";
  96. $sql = "mysql:host=$servername;dbname=$database;";
  97. $option = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION];
  98.  
  99. // Create a new connection to the MySQL database using PDO, $konek is an object
  100. try {
  101. $konek = new PDO($sql, $username, $password, $option);
  102. echo "sukses";
  103. } catch (PDOException $error) {
  104. echo 'Eror: ' . $error->getMessage();
  105. }
  106.  
  107. $users = $konek->prepare("SELECT * FROM siswa");
  108. $users->execute();
  109. $users = $users->fetchAll();
  110. foreach ($users as $user) {
  111. $nama_siswa=$user['namasiswa'];
  112. $sandi_siswa=$user['katasandi'];
  113. ?>
  114. <tr>
  115. <td> <?php echo $nama_siswa ?> </td>
  116. <td> <?php echo $sandi_siswa ?> </td>
  117. </tr>
  118. <?php
  119. }
  120. ?>
  121.  
  122. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement