Advertisement
Guest User

Untitled

a guest
Aug 14th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.86 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4.  
  5. <title>visualizzazione</title>
  6. </head>
  7.  
  8. <body>
  9. <?
  10. $hostname="localhost";
  11. $username="root";
  12. $password="root";
  13. // apertura della connessione con il server MySQL
  14. $conn=mysql_connect($hostname,$username,$password);
  15. if (! $conn)
  16. {
  17. echo "errore di conn";
  18. exit();
  19. }
  20. //selezione del database db2
  21. mysql_select_db("db2");
  22. $risu=mysql_query("SELECT * FROM ordini ORDER BY prezzo descr"); //non ho lo schema ER quindi controllare che la query sia corretta
  23.  
  24. //visualizza il contenuto della tabella
  25.  
  26. ?>
  27.  
  28. <table border=1 cellpadding=5>
  29. <tr>
  30. <td>Ordine</td>
  31. <td>Costo</td>
  32. </tr>
  33. <?
  34.  
  35. while ($riga=mysql_fetch_array($risu))
  36. {
  37. ?>
  38. <tr>
  39. <td><? echo $riga["ordine"]; ?></td> //controllare anche qui
  40. <td><? echo $riga["costo"]; ?></td>  //che gli attributi siano corretti
  41. </tr>
  42. <?
  43. }
  44.  
  45.  
  46. mysql_close($conn);
  47. ?>
  48. </table>
  49. </body>
  50.  
  51. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement