|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Aug 2002
Messaggi: 3958
|
da asp a php
Ciao a tutti
ho uno scrip in asp che fa delle ricerche in un file access: questa è la pagina html con il modulo di ricerca: <head> <title>modulo</title> </head> <body> <form method="POST" action="ricerca.asp"> <table border="0" width="48%" cellspacing="1"> <tr> <td width="1%"><b>Ruolo</b></td> <td width="101%"><select size="1" name="form_dati"> <option></option> <option>WebMaster</option> <option>WebDesigner</option> <option>Programmatore</option> </td> </tr> <tr> <td width="1%"><b>Cognome</b></td> <td width="101%"><input type="text" name="form_nome" size="20"></td> </tr> <tr> <td width="54%"><input type="submit" value="Invia" name="B1"><input type="reset" value="Reimposta dati" name="B2"> </form> </td> </tr> </table> </form> </body> </html> che richiama questo file asp che effettua le ricerche (anche multiple): <p align="left"><font color="#008080"><a href="modulo.htm">Torna al modulo</a></font></p> <center> <table border="0" width="330" height="28"> <tr> <td width="120" height="28"><b><font size="4"><i>Nome</i></font></b><td width="130" height="28"><b><font size="4"><i>Cognome</i></font></b><td width="100" height="28"> <b><font size="4"><i>Ruolo</i></font></b> </tr> </table> </center> <br> <%@Language="VBScript"%> <% Dim oRS, oConn Set oRS = Server.CreateObject("ADODB.Recordset") Set oConn = Server.CreateObject("ADODB.Connection") oConn.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("test.mdb") oConn.Open parola=Request.form("form_dati") parola2=Request.form("form_nome") strSQL="SELECT * FROM tabella WHERE Ruolo LIKE '%"& parola &"%' AND Cognome LIKE '%"& parola2 &"%' " x = 1 oRS.Open strSQL, oConn,1,3 conta=oRS.RecordCount if not oRS.Eof then Do while not oRS.EOF %> <center> <table border="0" width="330" height="28"> <tr> <td width="120" height="28"><b><font color="#FF0000" size="4"><%=oRS("Soprannome")%> </font></b> <td width="130" height="28"><font color="#FF0000" size="4"><b><%=oRS("Cognome")%></b></font></td> <td width="100" height="28"><font color="#0000FF"><b><%=oRS("Ruolo")%></b></font></td> </tr> </table> </center> <% x = x + 1 oRS.MoveNext Loop end if Set oRS = Nothing oConn.Close Set oConn = Nothing %> questo script è molto comodo è risponde quasi esattamente alle mie esigenze, tranne per un fatto: mi serve in php e il database è mysql. Chi mi aiuta a trasformarlo in php? ho provato anche php2shell (programma per convertire file da asp a php) ma non ho capito ancora come si converte il file Grazie anticipatamente. ciao |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Aug 2002
Messaggi: 3958
|
dai!
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 20:41.



















