469,358 Members | 1,629 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,358 developers. It's quick & easy.

Separating results

MRK
I want to add a <p> after 10 results are given
and do this in a loop after every 10 results.
Here is my query and my current results code

How would I modify this to add a <P> after
every 10 results for ts?

<%
Response.Buffer = True
Dim connStrx, rs, ss, ts, book1, verse1, chap1, bookopt
connStrx = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("\data\kwm\kjv.mdb")
Set rs = CreateObject("ADODB.Recordset")
Set ss = CreateObject("ADODB.Recordset")
Set ts = CreateObject("ADODB.Recordset")

rs.Open "select distinct booktitle, book from bibletable order by book ASC",
connStrx, 3, 4
If Not rs.EOF Then
If Request.Form("Submit")="GO" Then
bookopt = request.form("book")
else
bookopt=""
end if
While Not rs.EOF
If trim(bookopt) = trim(rs("booktitle")) then
response.write "<option value='" & rs("booktitle") & "' selected>" &
rs("booktitle") & "</option>"
else
response.write "<option value='" & rs("booktitle") & "'>" &
rs("booktitle") & "</option>"
end if
rs.MoveNext
Wend

ELSE
END IF
rs.close
set rs = nothing

If len(bookopt)>1 Then
ss.Open "select distinct chapter from bibletable where
[bibletable.booktitle]='" & bookopt & "' order by chapter ASC", connStrx, 3,
4
If Not ss.EOF Then
While Not ss.EOF
chap1=ss("chapter")
response.write ss("chapter")

' here is where I want to create a <p> after every 10 results

ts.Open "select * from bibletable where [bibletable.booktitle]='" &
bookopt & "' and [bibletable.chapter]=" & chap1 & " order by verse ASC",
connStrx, 3, 4
If Not ts.EOF Then
While Not ts.EOF
response.write " <font color=red>" & ts("verse") & "</font> " &
ts("textdata") & " "
ts.MoveNext
Wend
ts.close
else
end if
ss.MoveNext
Wend
else
end if
end if
%>
Jul 19 '05 #1
4 1199
outside the loop put in a variable (XX = 0)
At that point in the loop you want the <P> do a:
IF XX >= 10 then
..."<P>"....
XX = 0
ELSE
XX = XX + 1
END IF
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"MRK" <sdkngfksdnf> wrote in message
news:ud**************@TK2MSFTNGP09.phx.gbl...
I want to add a <p> after 10 results are given
and do this in a loop after every 10 results.
Here is my query and my current results code

How would I modify this to add a <P> after
every 10 results for ts?

<%
Response.Buffer = True
Dim connStrx, rs, ss, ts, book1, verse1, chap1, bookopt
connStrx = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("\data\kwm\kjv.mdb")
Set rs = CreateObject("ADODB.Recordset")
Set ss = CreateObject("ADODB.Recordset")
Set ts = CreateObject("ADODB.Recordset")

rs.Open "select distinct booktitle, book from bibletable order by book ASC", connStrx, 3, 4
If Not rs.EOF Then
If Request.Form("Submit")="GO" Then
bookopt = request.form("book")
else
bookopt=""
end if
While Not rs.EOF
If trim(bookopt) = trim(rs("booktitle")) then
response.write "<option value='" & rs("booktitle") & "' selected>" &
rs("booktitle") & "</option>"
else
response.write "<option value='" & rs("booktitle") & "'>" &
rs("booktitle") & "</option>"
end if
rs.MoveNext
Wend

ELSE
END IF
rs.close
set rs = nothing

If len(bookopt)>1 Then
ss.Open "select distinct chapter from bibletable where
[bibletable.booktitle]='" & bookopt & "' order by chapter ASC", connStrx, 3, 4
If Not ss.EOF Then
While Not ss.EOF
chap1=ss("chapter")
response.write ss("chapter")

' here is where I want to create a <p> after every 10 results

ts.Open "select * from bibletable where [bibletable.booktitle]='" &
bookopt & "' and [bibletable.chapter]=" & chap1 & " order by verse ASC",
connStrx, 3, 4
If Not ts.EOF Then
While Not ts.EOF
response.write " <font color=red>" & ts("verse") & "</font> " &
ts("textdata") & " "
ts.MoveNext
Wend
ts.close
else
end if
ss.MoveNext
Wend
else
end if
end if
%>

Jul 19 '05 #2
The simple way is to put in a counter like so (added code in uppercase):

DIM I
I = 1
RESPONSE.WRITE "<p>"
While Not ss.EOF
chap1=ss("chapter")
response.write ss("chapter")

' here is where I want to create a <p> after every 10 results
IF I = 10 THEN
RESPONSE.WRITE "</p>" & vbCrLf & "<p>"
I = 0
END IF

ts.Open "select * from bibletable where [bibletable.booktitle]='" &
bookopt & "' and [bibletable.chapter]=" & chap1 & " order by verse ASC",
connStrx, 3, 4
If Not ts.EOF Then
While Not ts.EOF
response.write " <font color=red>" & ts("verse") & "</font> " &
ts("textdata") & " "
ts.MoveNext
Wend
ts.close
else
end if
ss.MoveNext

I = I + 1

Wend
Ray at work

"MRK" <sdkngfksdnf> wrote in message
news:ud**************@TK2MSFTNGP09.phx.gbl...
I want to add a <p> after 10 results are given
and do this in a loop after every 10 results.
Here is my query and my current results code

How would I modify this to add a <P> after
every 10 results for ts?


Jul 19 '05 #3
MRK
DOH !!!
so simple. thanks
I should apply my VFP experience more in ASP
I do simple loops like this all the time in VFP

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:uc*************@TK2MSFTNGP10.phx.gbl...
outside the loop put in a variable (XX = 0)
At that point in the loop you want the <P> do a:
IF XX >= 10 then
..."<P>"....
XX = 0
ELSE
XX = XX + 1
END IF
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"MRK" <sdkngfksdnf> wrote in message
news:ud**************@TK2MSFTNGP09.phx.gbl...
I want to add a <p> after 10 results are given
and do this in a loop after every 10 results.
Here is my query and my current results code

How would I modify this to add a <P> after
every 10 results for ts?

<%
Response.Buffer = True
Dim connStrx, rs, ss, ts, book1, verse1, chap1, bookopt
connStrx = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("\data\kwm\kjv.mdb")
Set rs = CreateObject("ADODB.Recordset")
Set ss = CreateObject("ADODB.Recordset")
Set ts = CreateObject("ADODB.Recordset")

rs.Open "select distinct booktitle, book from bibletable order by book ASC",
connStrx, 3, 4
If Not rs.EOF Then
If Request.Form("Submit")="GO" Then
bookopt = request.form("book")
else
bookopt=""
end if
While Not rs.EOF
If trim(bookopt) = trim(rs("booktitle")) then
response.write "<option value='" & rs("booktitle") & "' selected>" & rs("booktitle") & "</option>"
else
response.write "<option value='" & rs("booktitle") & "'>" &
rs("booktitle") & "</option>"
end if
rs.MoveNext
Wend

ELSE
END IF
rs.close
set rs = nothing

If len(bookopt)>1 Then
ss.Open "select distinct chapter from bibletable where
[bibletable.booktitle]='" & bookopt & "' order by chapter ASC",

connStrx, 3,
4
If Not ss.EOF Then
While Not ss.EOF
chap1=ss("chapter")
response.write ss("chapter")

' here is where I want to create a <p> after every 10 results

ts.Open "select * from bibletable where [bibletable.booktitle]='" &
bookopt & "' and [bibletable.chapter]=" & chap1 & " order by verse ASC",
connStrx, 3, 4
If Not ts.EOF Then
While Not ts.EOF
response.write " <font color=red>" & ts("verse") & "</font> " &
ts("textdata") & " "
ts.MoveNext
Wend
ts.close
else
end if
ss.MoveNext
Wend
else
end if
end if
%>


Jul 19 '05 #4
MRK
Thanks Ray.
as I told Curt. I do simple loops like
this in VFP and did not think I could do
it in ASP..

I did have to rearrange the loop though
as I wanted the <p> within the ts results
10 was also to high and had use 7

Thanks again for the assist

<%
If Not ts.EOF Then
TX=1
While Not ts.EOF
IF TX = 7 THEN
RESPONSE.WRITE "</p>" & vbCrLf & "<p>"
TX = 0
END IF
response.write " <font color=red>" & ts("verse") & "</font> " &
ts("textdata") & " "
ts.MoveNext
TX = TX + 1
Wend
ts.close
else
end if
%>
"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:%2****************@TK2MSFTNGP11.phx.gbl...
The simple way is to put in a counter like so (added code in uppercase):

DIM I
I = 1
RESPONSE.WRITE "<p>"
While Not ss.EOF
chap1=ss("chapter")
response.write ss("chapter")

' here is where I want to create a <p> after every 10 results
IF I = 10 THEN
RESPONSE.WRITE "</p>" & vbCrLf & "<p>"
I = 0
END IF

ts.Open "select * from bibletable where [bibletable.booktitle]='" &
bookopt & "' and [bibletable.chapter]=" & chap1 & " order by verse ASC",
connStrx, 3, 4
If Not ts.EOF Then
While Not ts.EOF
response.write " <font color=red>" & ts("verse") & "</font> " &
ts("textdata") & " "
ts.MoveNext
Wend
ts.close
else
end if
ss.MoveNext

I = I + 1

Wend
Ray at work

"MRK" <sdkngfksdnf> wrote in message
news:ud**************@TK2MSFTNGP09.phx.gbl...
I want to add a <p> after 10 results are given
and do this in a loop after every 10 results.
Here is my query and my current results code

How would I modify this to add a <P> after
every 10 results for ts?

Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Patrick | last post: by
3 posts views Thread by Kai Grossjohann | last post: by
2 posts views Thread by Riegn Man | last post: by
39 posts views Thread by Joe Laughlin | last post: by
14 posts views Thread by Gilles Ganault | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.