Codice PHP:
<html> <head> <? <?php /* CONNESSIONE AL DB*/ if( !mysql_connect("localhost","root","") ){ die('Connect error: ' . mysql_error());} if( !mysql_select_db("docenti") ){ die('Select error: ' . mysql_error());} ?> <title>Prova</title> <style> body{ font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;} </style> </head> <body> <form id="form1" name="form1" method="post" action=""> <table width="500px" border="0" cellpadding="5"> <tr> <td>Cliente</td> <td> <select> <?php //Recupero i dati dal DB $query = "SELECT Cognome " . "FROM 'Professori' " . "ORDER BY 'Cognome'"; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)){ $myfield_1 = $row['myfield_1']; echo "\t<option value=\"$myfield_1</option>\n"; } ?> </select> </td> </tr> </table> </form> </body> </html>
Ti ringrazio, io sono riuscito a fare ciò, e come vedrai è sbagliato. Sai aiutarmi? grazie! So eseguire una query ma non recuperare i dati