Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>visualizzazione</title>
- </head>
- <body>
- <?
- $hostname="localhost";
- $username="root";
- $password="root";
- // apertura della connessione con il server MySQL
- $conn=mysql_connect($hostname,$username,$password);
- if (! $conn)
- {
- echo "errore di conn";
- exit();
- }
- //selezione del database db2
- mysql_select_db("db2");
- $risu=mysql_query("SELECT * FROM ordini ORDER BY prezzo descr"); //non ho lo schema ER quindi controllare che la query sia corretta
- //visualizza il contenuto della tabella
- ?>
- <table border=1 cellpadding=5>
- <tr>
- <td>Ordine</td>
- <td>Costo</td>
- </tr>
- <?
- while ($riga=mysql_fetch_array($risu))
- {
- ?>
- <tr>
- <td><? echo $riga["ordine"]; ?></td> //controllare anche qui
- <td><? echo $riga["costo"]; ?></td> //che gli attributi siano corretti
- </tr>
- <?
- }
- mysql_close($conn);
- ?>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement