Advertisement
Guest User

Untitled

a guest
May 18th, 2017
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. <?php
  2. $db_host = 'localhost'; // Server Name
  3. $db_user = 'plpgmcom_lpg'; // Username
  4. $db_pass = '0811919026'; // Password
  5. $db_name = 'plpgmcom_lpg'; // Database Name
  6.  
  7. $conn = mysqli_connect($db_host, $db_user, $db_pass, $db_name);
  8. if (!$conn) {
  9. die ('Failed to connect to MySQL: ' . mysqli_connect_error());
  10. }
  11. $conn->query("SET NAMES UTF8");
  12.  
  13. $sql = 'SELECT * FROM LPG ORDER BY item DESC LIMIT 1';
  14.  
  15. $query = mysqli_query($conn, $sql);
  16.  
  17. if (!$query) {
  18. die ('SQL Error: ' . mysqli_error($conn));
  19. }
  20.  
  21. ?>
  22. <html>
  23. <head>
  24. <meta http-equiv=Content-Type content="text/html; charset=utf-8">
  25. <title> List of data </title>
  26. <style type="text/css">
  27. body {
  28. font-size: 15px;
  29. color: #343d44;
  30. padding: 0;
  31. margin: 0;
  32. }
  33. table {
  34. margin: auto;
  35. font-size: 12px;
  36. }
  37.  
  38. h1 {
  39. margin: 25px auto 0;
  40. text-align: center;
  41. text-transform: uppercase;
  42. font-size: 17px;
  43. }
  44.  
  45. table td {
  46. transition: all .5s;
  47. }
  48.  
  49. /* Table */
  50. .data-table {
  51. border-collapse: collapse;
  52. font-size: 14px;
  53. min-width: 537px;
  54. }
  55.  
  56. .data-table th,
  57. .data-table td {
  58. border: 1px solid #e1edff;
  59. padding: 7px 17px;
  60. }
  61. .data-table caption {
  62. margin: 7px;
  63. }
  64.  
  65. /* Table Header */
  66. .data-table thead th {
  67. background-color: #508abb;
  68. color: #FFFFFF;
  69. border-color: #6ea1cc !important;
  70. text-transform: uppercase;
  71. }
  72.  
  73. /* Table Body */
  74. .data-table tbody td {
  75. color: #353535;
  76. }
  77. .data-table tbody td:first-child,
  78. .data-table tbody td:nth-child(4),
  79. .data-table tbody td:last-child {
  80. text-align: right;
  81. }
  82.  
  83. .data-table tbody tr:nth-child(odd) td {
  84. background-color: #f4fbff;
  85. }
  86. .data-table tbody tr:hover td {
  87. background-color: #ffffa2;
  88. border-color: #ffff0f;
  89. }
  90.  
  91. /* Table Footer */
  92. .data-table tfoot th {
  93. background-color: #e5f5ff;
  94. text-align: right;
  95. }
  96. .data-table tfoot th:first-child {
  97. text-align: left;
  98. }
  99. .data-table tbody td:empty
  100. {
  101. background-color: #ffcccc;
  102. }
  103. </style>
  104. </head>
  105. <body>
  106.  
  107. <h1>List of data</h1>
  108. <table class="data-table">
  109. <caption class="title">All of user list in data now.</caption>
  110. <thead>
  111. <tr>
  112. <th>No</th>
  113. <th>Name</th>
  114. <th>Surname</th>
  115. <th>Address</th>
  116. <th>Tel</th>
  117. <th>Location</th>
  118. <th>LPG</th>
  119. <th>SMOKE</th>
  120. <th>datetime</th>
  121. </tr>
  122. </thead>
  123. <tbody>
  124. <?php
  125. $no = 1;
  126. $total = 0;
  127. while ($row = mysqli_fetch_array($query))
  128. {
  129. $amount = $row['amount'] == 0 ? '' : number_format($row['amount']);
  130. echo '<tr>
  131. <td>'.$no.'</td>
  132. <td>'.$row['Name'].'</td>
  133. <td>'.$row['Surname'].'</td>
  134. <td>'.$row['Address'].'</td>
  135. <td>'.$row['Tel'].'</td>
  136. <td>'.$row['Location'].'</td>
  137. <td>'.$row['LPG'].'</td>
  138. <td>'.$row['SMOKE'].'</td>
  139. <td>'.$row['datetime'].'</td>
  140. </tr>';
  141. $no++;
  142. }?>
  143. </tbody>
  144. </table>
  145.  
  146.  
  147. </script>
  148. </body>
  149. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement