Advertisement
MizunoBrasil

Javascript 03

Jan 27th, 2023
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.33 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.   <head>
  4.     <title>Media List</title>
  5.     <meta charset="UTF-8">
  6.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8.     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
  9.   </head>
  10.   <body>
  11.     <div class="container">
  12.       <h1>Media List</h1>
  13.       <a href="form_cadastro.html">Cadastrar</a>
  14.       <br><br>
  15.         <table class="table table-striped">
  16.           <thead>
  17.             <tr>
  18.               <th>ID</th>
  19.               <th>Data</th>
  20.             </tr>
  21.           </thead>
  22.           <tbody>
  23.             <?php
  24.               // Connect to the database
  25.               $conn = mysqli_connect("servidor", "usuario", "senha", "base de dados");
  26.               // Retrieve data from the database
  27.               $query = mysqli_query($conn, "SELECT * FROM media ORDER BY id DESC");
  28.               while($row = mysqli_fetch_array($query)){
  29.                 echo "<tr>";
  30.                 echo "<td>". $row['id']. "</td>";
  31.                 echo "<td>". $row['data']. "</td>";
  32.                 echo "</tr>";
  33.               }
  34.               // Close the connection
  35.               mysqli_close($conn);
  36.             ?>
  37.           </tbody>
  38.         </table>
  39.     </div>
  40.   </body>
  41. </html>
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement