2012-02-02 5 views
0

나는 .asp 파일에서 이러한 기능을 .php 함수로 변환하거나 변환하려고 시도하고 있습니다. 아직 익숙하지 않기 때문에 .asp. 그들 중 일부는 SQL 명령과 원격 테이블의 데이터가있는 자리 표시 자 등을 인식하고 이해할 수 있으며 나머지는 혼란 스럽습니다. 나는 PHP의 include와 동등하다고 생각하는 include 같은 것을 이미 변환했다. 함수 및 여러 다른. 두 언어에 대한 실무 지식을 가진 사람이 어떤 기능이 어떤 위치에 있는지 알 수 있습니까?asp 함수를 통해 PHP로 변환

<!--#include virtual="/includes/functions.asp" --> 
<% 
intBusiness_Catagory = Request("select_catagory") 

Set thisConn = Server.CreateObject("ADODB.Connection") 
thisConn.Open CreateAfccDSN() 


SelectSQL = "SELECT * FROM BusinessInfo WHERE ((CatID = " & intBusiness_Catagory & ") or (CatID2 = " & intBusiness_Catagory & ") or (CatID3 = " & intBusiness_Catagory & ")) and (intStatusCodeID = 1) and (intOnWeb = 1) Order By vcBusinessName" 
Set SelectRs = thisConn.Execute(SelectSQL) 

If SelectRs.EOF Then 
    Response.Write("No members found for selected category.<br> Please search <a href='javascript:history.back()'>again</a>.") 
Else 
%> 
<b>Member Search Results:</b> 
<p> 

<% 
End If 

    If Not SelectRs.BOF AND Not SelectRs.EOF then 
     SelectRs.MoveFirst 
     Do Until SelectRs.EOF 
%> 
      <b><%=SelectRs("vcBusinessName") %></b><br> 
      <%=SelectRs("vcPhone") %><br> 
      <%=SelectRs("vcPAddress") %><br> 
      <%=SelectRs("vcPCity") %>, <%=SelectRs("vcPState") %>&nbsp;&nbsp;<%=SelectRs("vcPZipCode") %><br> 
      <% 
      If isNull(SelectRs("vcURL")) then 

      Else 
      %> 
       <b>Website: </b><a href="http://<%=SelectRs("vcURL") %>" target="_blank"><%=SelectRs("vcURL") %></a> 
      <% 
      End If 
      %> 
      <p> 
      <hr> 
<% 
      SelectRs.MoveNext 
     Loop 
%> 

<% 
    End If 

SelectRs.Close 
Set SelectRs = Nothing 
%> 
+2

에 할당합니다. ASP 코드의 어느 부분을 이해하지 못합니까? –

+0

if 문, Rewrite 문, Set thisConn = Server.CreateObject, thisConn.Open CreateAfccDSN() 및 intBusiness_Catagory가 주로 사용됩니다. – Tower

답변

0

이 스크립트는 데이터베이스를 열고 쿼리를 만들고 결과 레코드의 값을 출력합니다. 여기에있는 모든 것이 PHP 1 : 1에 해당하는 것은 아닙니다.

Set thisConn = Server.CreateObject -이 여기에 도시되지 CreateAfccDSN()라는 함수로부터 다시 전달 된 값을 사용하여, 데이터베이스 연결을 연다 - 이것은 데이터베이스 접속 대상물

thisConn.Open CreateAfccDSN()를 생성한다.

intBusiness_Catagory = Request("select_catagory") -이 select_catagory이라는 폼/URL 매개 변수를 사용하고 아무도 당신을 위해 다시 쓰기 코드에 예정되지 않은 지역 변수 intBusiness_Catagory

+0

고마워! 이 일은 나를 도울 것입니다. 다시 쓰기 명령은 어떻습니까? – Tower

+0

Response.Write = echo –

+0

알겠습니다. 코드에는 데이터베이스 사용자와 암호 또는 로그인 프로 시저의 흔적이 없습니다. 이것이 PHP와 얼마나 잘 작동하는지 잘 모르겠습니다. – Tower