Advertisement
Guest User

Untitled

a guest
May 2nd, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
  2. Stanza:<input type="text" name="stanza"><br>
  3. <input type ="submit" name="submit" value="Invia">
  4. </form>
  5.  
  6. <?php
  7. $host="localhost";
  8. $username="hellofriend";
  9. $password="";
  10. $db_nome="my_hellofriend";
  11. $tab_nome="";
  12. //connessione al server
  13. mysql_connect($host, $username, $password) or die('Impossibile connettersi al server: '.mysql_error());
  14. //accesso al database
  15. mysql_select_db($db_nome) or die ('Accessp al database non riuscito: '.mysql_error());
  16. // lettura dei dati dalla tabella
  17. $sql = "SELECT * FROM $tab_nome WHERE Stanza ='$stanza';";
  18. $result = mysql_query($sql);
  19. while($row = mysql_fetch_array($result)){
  20. echo "<table><tr><th>Codice</th><th>Nome</th></tr>";
  21. echo "<tr><td>" . $row["CodiceStanza"]. "</td><td>" . $row["Nome"]. "</td></tr>";
  22. echo "</table>";
  23. }
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement