Advertisement
Guest User

Untitled

a guest
May 14th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 2.62 KB | None | 0 0
  1. <?php
  2. $db_host = 'localhost'; // Server Name
  3. $db_user = 'root'; // Username
  4. $db_pass = ''; // Password
  5. $db_name = 'anul3'; // 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 *
  13.         FROM materiale';
  14.        
  15. $query = mysqli_query($conn, $sql);
  16.  
  17. if (!$query) {
  18.     die ('SQL Error: ' . mysqli_error($conn));
  19. }
  20. ?>
  21. <html>
  22. <head>
  23.     <title>Orar</title>
  24.     <style type="text/css">
  25.         body {
  26.             font-size: 15px;
  27.             color: #343d44;
  28.             font-family: "segoe-ui", "open-sans", tahoma, arial;
  29.             padding: 0;
  30.             margin: 0;
  31.         }
  32.         table {
  33.             margin: auto;
  34.             font-family: "Lucida Sans Unicode", "Lucida Grande", "Segoe Ui";
  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.     <h1>Anul 1</h1>
  107.     <table class="data-table">
  108.         <caption class="title">Orar semestrul 2, anul 2</caption>
  109.         <thead>
  110.             <tr>
  111.                 <th>NO</th>
  112.                 <th>Numele Materialului</th>
  113.                 <th>Cantitatea</th>
  114.                 <th>Pret</th>
  115.                 <th>Depozit</th>
  116.             </tr>
  117.         </thead>
  118.         <tbody>
  119.        
  120.         <?php
  121.         $no     = 1;
  122.         $total  = 0;
  123.         while ($row = mysqli_fetch_array($query))
  124.         {
  125.             echo '<tr>
  126.                     <td>'.$no.'</td>
  127.                     <td>'.$row['numele_materialului'].'</td>
  128.                     <td>'.$row['cantitatea'].'</td>
  129.                     <td>'.$row['pret'].'</td>
  130.                     <td>'.$row['depozit'].'</td>
  131.                 </tr>';
  132.             $no++;
  133.         }?>
  134.        
  135.         </tbody>
  136.  
  137.     </table>
  138. </body>
  139. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement