Code Conversion ASP --> PHP Example
| From: | David R | Date: | Tue, 13 Aug 2002 22:35:51 +0000 |
| Subject: | Code Conversion ASP --> PHP Example | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-15241@lists.php.net to get a copy of this message | ||
I am in the early stages of learning PHP as an alternative to ASP. I am
using MySQL and need a beginning nudge. If anyone has the time, could you
please convert the following basic code block into pure PHP/MySQL minus all
the MS bits? It's a very simple example I know but the principles would
help me to understand some things that are not sinking in right now. Thank
you!
<%
strConnection = "driver={MySQL ODBC 3.51
Driver};server=localhost;user=username;"
strConnection = strConnection & "pwd=demo;database=mysql450"
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open strConnection
strSQL = "SELECT * FROM categories"
Set objRS = objConn.Execute(strSQL)
Do While Not objRS.EOF
Response.Write objRS("categoryid") & ", "
Response.Write objRS("catdescription") & ", "
Response.Write objRS("catimage") & "<br>"
objRS.MoveNext
Loop
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>
David