Hi there,
New to PHP. I have always used ASP.
I am having trouble trying to do the things in PHP the way (or
similar) i did it in ASP.
In ASP I used an Access database. I now use a mySQL database.
I have been able to establish a connection.
I have figured out how to use include files.
What I need to know is this:
I want to create a recordset (?resultset) using a query.
in ASP I did it like this:
............... ............... ............... ....
<asp code.....
Dim cnn ' ADO connection
Dim rst ' ADO recordset
Dim strDBPath ' path to my Access database (*.mdb) file
Dim Type ' variable
Type = CStr(Request.Qu eryString("type ")) 'passing parrameter from URL
strDBPath = Server.MapPath( "/_database/data.mdb")
Set cnn = Server.CreateOb ject("ADODB.Con nection")
cnn.Open "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & strDBPath &
";"
Set rst = cnn.Execute("SE LECT * FROM table WHERE Type ='" & type & ")
............... ............... ............... ............... .......
At this point, I can call any field from my recordset in the html code
on the page by inserting something like <%=rst.Fields(" whatever
field").Value%> .
I could also do a loop by using:
<%Do While Not rst.EOF%>
do some stuff......
<% rstSimple.MoveN ext
Loop
%>
............... ............... ............... ............... ........
So, please can you help me by showing the equavilant PHP code for
this.
1. How to create a recordset using a query.
2. Inserting results of the recordset into the html code
3. Creating a loop.
Alistair
New to PHP. I have always used ASP.
I am having trouble trying to do the things in PHP the way (or
similar) i did it in ASP.
In ASP I used an Access database. I now use a mySQL database.
I have been able to establish a connection.
I have figured out how to use include files.
What I need to know is this:
I want to create a recordset (?resultset) using a query.
in ASP I did it like this:
............... ............... ............... ....
<asp code.....
Dim cnn ' ADO connection
Dim rst ' ADO recordset
Dim strDBPath ' path to my Access database (*.mdb) file
Dim Type ' variable
Type = CStr(Request.Qu eryString("type ")) 'passing parrameter from URL
strDBPath = Server.MapPath( "/_database/data.mdb")
Set cnn = Server.CreateOb ject("ADODB.Con nection")
cnn.Open "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & strDBPath &
";"
Set rst = cnn.Execute("SE LECT * FROM table WHERE Type ='" & type & ")
............... ............... ............... ............... .......
At this point, I can call any field from my recordset in the html code
on the page by inserting something like <%=rst.Fields(" whatever
field").Value%> .
I could also do a loop by using:
<%Do While Not rst.EOF%>
do some stuff......
<% rstSimple.MoveN ext
Loop
%>
............... ............... ............... ............... ........
So, please can you help me by showing the equavilant PHP code for
this.
1. How to create a recordset using a query.
2. Inserting results of the recordset into the html code
3. Creating a loop.
Alistair
Comment