I need to select a bunch of records from a MySQL DB and insert them into some HTML.
The code I'm using right now simply reads the querystring and grabs just that one record, but I need to modify it to grab everything and print it out.
The code currently stands at:
Dim strWhatPic
strWhatPic = Request.QueryString("pic")
Dim objConn
set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open strConnString
Dim objRS
set objRS = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM pictures WHERE PIC_ID = " & strWhatPic
objRS.Open strSQL, objConn
strPIC_URL = objRS("PIC_URL")
strPIC_BORDER = objRS("PIC_BORDER")
strPIC_DESCRIPTION = objRS("PIC_DISCRIPTION")
%>
<img src="<% = strPIC_URL %>" border="<% = strPIC_BORDER %>" alt="<% = strPIC_DESCRIPTION %>">
<%
objRS.Close
set objRS = nothing
objConn.Close
set objConn = nothing
%>
How can I loop this so that it grabs everything from the PICTURES table and inserts it as HTML.
This is what I've come up with so far but it doesn't seem to work...
Dim strWhatPic
strWhatPic = Request.QueryString("pic")
Dim objConn
set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open strConnString
Dim objRS
set objRS = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM pictures WHERE PIC_ID = " & strWhatPic
objRS.Open strSQL, objConn
strPIC_URL = objRS("PIC_URL")
strPIC_BORDER = objRS("PIC_BORDER")
strPIC_DESCRIPTION = objRS("PIC_DISCRIPTION")
strWhatPic = strWhatPic + 1
rs.MoveNext
do until strSQL.EOF = True
loop
%>
Umm... yeah... I just chopped that code together... I really didn't think it would work, but I figured it was a starting point.
Can anyone help?
Thanks.
-------------------------
http://forums.akghetto.com
OS: Win2000 Adv Server SP2
Webserver: IIS 5.0
Snitz: 3.3.03
MySQL: 3.23.40
ODBC Driver: MySQL v.2.50.37.00 - 20.Apr.01