I am attempting to translate or convert these functions from a .asp file into .php functions as i am not familiar with .asp as of yet.
Some of them i recognize and can comprehend such as the SQL commands and the placeholders where data from the remote table would go, and the rest have my confused.
I have already converted some such as the include which i believe is the equivalent to PHP’s include ”; function and several others. Could someone with working knowledge of both languages show me which functions go where?
<!--#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") %> <%=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
%>
This script opens a database, makes a query and spits out values from the resulting records. Not everything here has a 1:1 PHP equivalent.
Set thisConn = Server.CreateObject– this creates a database connection objectthisConn.Open CreateAfccDSN()– This opens the database connection, using values passed back from a function called CreateAfccDSN(), which is not shown here.intBusiness_Catagory = Request("select_catagory")– This takes a form/url parameter calledselect_catagoryand assigns it to the local variableintBusiness_Catagory