Advertisement
Guest User

SQL

a guest
Jul 17th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.88 KB | None | 0 0
  1. <?php
  2. $db_host = 'localhost'; // Server Name
  3. $db_user = ''; // Username
  4. $db_pass = ''; // Password
  5. $db_name = ''; // 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.  
  12. $sql = 'SELECT * FROM users';
  13. $query = mysqli_query($conn, $sql);
  14.  
  15. if (!$query) {
  16.     die ('SQL Error: ' . mysqli_error($conn));
  17. }
  18. ?>
  19. <html>
  20. <head>
  21.     <title>MATTA Clients List - My Home Gets Me Campaign</title>
  22.     <style type="text/css">
  23.         body {
  24.             font-size: 15px;
  25.             color: #343d44;
  26.             font-family: "segoe-ui", "open-sans", tahoma, arial;
  27.             padding: 0;
  28.             margin: 0;
  29.         }
  30.         table {
  31.             margin: auto;
  32.             font-family: "Lucida Sans Unicode", "Lucida Grande", "Segoe Ui";
  33.             font-size: 12px;
  34.         }
  35.  
  36.         h1 {
  37.             margin: 25px auto 0;
  38.             text-align: center;
  39.             text-transform: uppercase;
  40.             font-size: 17px;
  41.         }
  42.  
  43.         table td {
  44.             transition: all .5s;
  45.         }
  46.        
  47.         /* Table */
  48.         .data-table {
  49.             border-collapse: collapse;
  50.             font-size: 14px;
  51.             min-width: 537px;
  52.         }
  53.  
  54.         .data-table th,
  55.         .data-table td {
  56.             border: 1px solid #e1edff;
  57.             padding: 7px 17px;
  58.         }
  59.         .data-table caption {
  60.             margin: 7px;
  61.         }
  62.  
  63.         /* Table Header */
  64.         .data-table thead th {
  65.             background-color: #508abb;
  66.             color: #FFFFFF;
  67.             border-color: #6ea1cc !important;
  68.             text-transform: uppercase;
  69.         }
  70.  
  71.         /* Table Body */
  72.         .data-table tbody td {
  73.             color: #353535;
  74.         }
  75.         .data-table tbody td:first-child,
  76.         .data-table tbody td:nth-child(4),
  77.         .data-table tbody td:last-child {
  78.             text-align: right;
  79.         }
  80.  
  81.         .data-table tbody tr:nth-child(odd) td {
  82.             background-color: #f4fbff;
  83.         }
  84.         .data-table tbody tr:hover td {
  85.             background-color: #ffffa2;
  86.             border-color: #ffff0f;
  87.         }
  88.  
  89.         /* Table Footer */
  90.         .data-table tfoot th {
  91.             background-color: #e5f5ff;
  92.             text-align: right;
  93.         }
  94.         .data-table tfoot th:first-child {
  95.             text-align: left;
  96.         }
  97.         .data-table tbody td:empty
  98.         {
  99.             background-color: #ffcccc;
  100.         }
  101.     </style>
  102. </head>
  103. <body>
  104.     <h1>My Home Gets Me</h1>
  105.     <table class="data-table">
  106.         <caption class="title"></caption>
  107.         <thead>
  108.             <tr>
  109.                 <th>Full Name</th>
  110.                 <th>Email</th>
  111.                 <th>Phone</th>
  112.                 <th>Age</th>
  113.                 <th>Style</th>
  114.                 <th>Looking For</th>
  115.                 <th>Gender</th>
  116.                 <th>Code</th>
  117.                 <th>Branch</th>
  118.                 <th>Validation Time</th>
  119.             </tr>
  120.         </thead>
  121.         <tbody>
  122.         <?php
  123.             while ($row = mysqli_fetch_array($query))
  124.                 {
  125.                     echo '<tr>
  126.                             <td>'.$row['full_name'].'</td>
  127.                             <td>'.$row['email'].'</td>
  128.                             <td>'.$row['phone'].'</td>
  129.                             <td>'.$row['age'].'</td>
  130.                             <td>'.$row['style'].'</td>
  131.                             <td>'.$row['lookingfor'].'</td>
  132.                             <td>'.$row['gender'].'</td>
  133.                             <td>'.$row['code'].'</td>
  134.                             <td>'.$row['branchs_id'].'</td>
  135.                             <td>'.$row['validated_at'].'</td>
  136.                         </tr>';
  137.                 }
  138.             ?>
  139.         </tbody>
  140.     </table>
  141. </body>
  142. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement