Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <?php
- $host="localhost";
- $username="username";
- $password="password";
- $db_nome="database";
- // connessione al server
- mysql_connect($host, $username, $password) or die('Impossibile connettersi al server: ' . mysql_error());
- // accesso al database
- mysql_select_db($db_nome) or die ('Accesso non riuscito: ' . mysql_error());
- // lettura dei dati dalla tabella
- $tab_nome="Stanza";
- $sql = "SELECT * FROM $tab_nome";
- $result = mysql_query($sql);
- echo "<table><tr><td>CodiceStanza</td><td>Tipologia</td><td>Climatizzatore</td></tr>";
- while($row = mysql_fetch_array($result)) {
- // operazioni sulla riga
- echo "<tr>";
- echo "<td>" . $row["CodiceStanza"] . "</td>";
- echo "<td>" . $row["Tipologia"] . "</td>";
- echo "<td>" . $row["Climatizzatore"] . "</td>";
- echo "<td>" . $row["Cucina"] . "</td>";
- echo "<td>" . $row["NumeroLetti"] . "</td>";
- echo "</tr>; } // fine while
- echo "</table>";
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement