Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "root";
- $dbname = "prodotti";
- //Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- //Check connection
- if ($conn->connect_error) {
- die("Connessione fallita: " . $conn->connect_error);
- }
- $sql = "SELECT * FROM lista_prodotti";
- $result = $conn->query($sql);
- $row = $result->fetch_assoc();
- echo '
- <div id="table">
- <table border="1" cellpadding="3">
- <colgroup>
- <col span="3" width="250px">
- </colgroup>
- <thead>
- <tr>
- <th><strong>Nome Prodotto</strong></th>
- <th><strong>Quantità</strong></th>
- <th><strong>Scadenza</strong></th>
- </tr>
- </thead>
- </table>';
- while ($row = $result->fetch_assoc()) {
- echo '
- <table border="1" cellpadding="3">
- <colgroup>
- <col span="3" width="250px">
- </colgroup>
- <tbody>
- <tr>
- <td>' . $row["nome_prodotto"] . '</td>
- <td>' . $row["quantita"] . '</td>
- <td>' . $row["scadenza"] . '</td>
- </tr>
- </tbody>
- </table>
- </div>
- ';}
- $conn->close();
- ?>
Add Comment
Please, Sign In to add comment