Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML>
- <html>
- <head>
- <title>Pagina</title>
- </head>
- <body>
- <div align="center">
- <h1>Prova connessione</h1>
- <table width="200" border="1">
- <tr>
- <th>Matricola</th>
- <th>Nome</th>
- <th>Cognome</th>
- <th>Cod. fiscale</th>
- <th>Telefono</th>
- </tr>
- <?php
- $cognome = $_POST['cognome'];
- $host = "127.0.0.1";
- $user="hello";
- $password = "malafarina";
- $db = "hello";
- $table = "Studenti";
- mysql_connect($host, $user, $password) or die ("Connessione non riuscita ".mysql_error());
- mysql_select_db($db) or die ("Database inesistente".mysql_error());
- $sql_query = "SELECT * FROM $table WHERE Cognome = \"".$cognome."\";";
- $risultato = mysql_query($sql_query);
- while($riga = mysql_fetch_array($risultato))
- {
- print "<tr>\n";
- print "<td>".$riga['Matricola']."</td>\n";
- print "<td>".$riga['Nome']."</td>\n";
- print "<td>".$riga['Cognome']."</td>\n";
- print "<td>".$riga['CodFiscale']."</td>\n";
- print "<td>".$riga['Telefono']."</td>\n";
- print "</tr>\n ";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement