Reply
Dynamic Pages
Old 09-29-2004, 10:33 AM Dynamic Pages
frik's Avatar
Average Talker

Posts: 26
Location: SOuth Africa
I have lets say 43 records in my recordset. Each Record do hav a link to a *.jpg that must be displayed. What I want to do is to display 5 pictures in a row with two rows on a page. Is there a way that If I am done with page 1 (RS 1 -10) that I can create another page dynamically ?

Page 1
Pic 1 2 3 4 5
6 7 8 9 10
Next Page >>

Page 2
Pic 11 12 13 14 15
16 17 18 19 20
Next Page >>

this must carry on untill all the records are displayed.

Your help is appreciated
frik is offline
Reply With Quote
View Public Profile Visit frik's homepage!
 
When You Register, These Ads Go Away!
Old 09-29-2004, 10:59 AM
Kyrnt's Avatar
The Post-Mod Years

Posts: 2,536
Location: Western Maryland
Frik, sorry, I thought we had covered this in thread http://www.webmaster-talk.com/showthread.php?t=15720.

What problems are you having and could you post whatever code you have written so far and a description of the problems you are having?
__________________
—Kyrnt
Kyrnt is offline
Reply With Quote
View Public Profile Visit Kyrnt's homepage!
 
Old 09-29-2004, 11:00 AM
pencer's Avatar
Extreme Talker

Posts: 179
Location: Nottingham UK
If you use Dreamweaver then this is quite simple. You just need to create your recordset, then use the Repeat Region Server Behaviour. With this you can limit how many records are displayed at once. And then maybe use the Move To Next and Move To Previous Server Behaviours to let you navigate between the pages.

If you don't use Dreamweaver then its a matter of creating a while..wend loop (i use vbscript) to retrieve the first 10 records and display them in your table. You can repeat this till the end of the recordset, i.e until MyRecordset.EOF.

I can share a useful Dreamweaver tutorial on this if needed.

Cheers,
pencer.
pencer is offline
Reply With Quote
View Public Profile Visit pencer's homepage!
 
Old 09-30-2004, 02:37 AM ASP & Dynamic Pages
frik's Avatar
Average Talker

Posts: 26
Location: SOuth Africa
KYRT you did cover the topic and it helped me a lot. The problems I do encounter now is that I write a "name" If I use the right arrows, it is worl\king but when I am using the left arrows it is not working. I am putting all the results on the same page.

<%@ language=VBScript %>
<% Option Explicit %>

<%
Dim strDbPath
strDbPath = "fpdb/Application.mdb"
strDbPath = Server.MapPath(strDbPath)

Dim objConn
Set objConn = server.createobject("ADODB.Connection")
objConn.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & strDbPath
objConn.Open

Dim strSQL
DIM strWhereClause
DIM strAnd
DIM strWhere
DIM strOR

strSQL = "SELECT * FROM application "

strWhereClause = ""
strAnd = " and "
strWhere = " where "

If Request.Form("firstname") <> "" Then
strWhereClause = strWhereClause & " firstname LIKE '" & Request.Form("firstname") & "%'"
End If

If Len(Request.Form("haircolour")) > 1 Then
If strWhereClause <> "" Then
strWhereClause = strWhereClause & " AND "
End If
strWhereClause = strWhereClause & " haircolour LIKE '" & Request.Form("haircolour") & "%'"
End If

If Len(Request.Form("hairlength")) > 1 Then
If strWhereClause <> "" Then
strWhereClause = strWhereClause & " AND "
End If
strWhereClause = strWhereClause & " hairlength LIKE '" & Request.Form("hairlength") & "%'"
End If

If Len(Request.Form("eyecolour")) > 1 Then
If strWhereClause <> "" Then
strWhereClause = strWhereClause & " AND "
End If
strWhereClause = strWhereClause & " eyecolour LIKE '" & Request.Form("eyecolour") & "%'"
End If

If Len(Request.Form("height")) > 1 Then
If strWhereClause <> "" Then
strWhereClause = strWhereClause & " AND "
End If
strWhereClause = strWhereClause & " height LIKE '" & Request.Form("height") & "%'"
End If

If Len(Request.Form("bustsize")) > 1 Then
If strWhereClause <> "" Then
strWhereClause = strWhereClause & " AND "
End If
strWhereClause = strWhereClause & " bustsize LIKE '" & Request.Form("bustsize") & "%'"
End If

If Len(Request.Form("dresssize")) > 1 Then
If strWhereClause <> "" Then
strWhereClause = strWhereClause & " AND "
End If
strWhereClause = strWhereClause & " dresssize LIKE '" & Request.Form("dresssize") & "%'"
End If

If Len(Request.Form("shoesize")) > 1 Then
If strWhereClause <> "" Then
strWhereClause = strWhereClause & " AND "
End If
strWhereClause = strWhereClause & " shoesize LIKE '" & Request.Form("shoesize") & "%'"
End If


If strWhereClause <> "" Then
strSQL = strSQL & " WHERE " & strWhereClause
End If

Dim objRS
Set objRS = Server.CreateObject ("ADODB.Recordset")
objRS.Open strSQL, objConn , 3

Dim rCount
Dim lCount
Dim recCount
Dim recResult
Dim nameCount
Dim zCount
Dim nameName

If objRS.eof then
Response.Redirect("searchres.htm")
End If
Response.Write "<a name""0""></a>"
Response.Write "<table width=""10%"" border=""1"" align=""center"">"
Response.Write "<tr>"

rCount = 0
lCount = 0
recCount = 1
'recCount1 = recCount + 10
recResult = 0
nameCount = 0
zCount = 100
'nameName = "Top"

Do While not objRS.EOF
Response.Write "<td>"

%>
<img src="<%Response.Write objRS("image")%>" height="150" width="100">
<%
'Response.Write "&nbsp;"
Response.Write "</td>"

rCount = rCount + 1
lCount = lCount + 1

'Response.Write "AA" & rCount
'Response.Write "BB" & lCount
'Response.Write "CC" & recCount
'Response.Write "DD" & nameCount
'Response.Write "EE" & recResult
'Response.Write "FF" & objRS.RecordCount
'Response.Write "GG" & zCount
'Response.Write "<a name>"

if rCount = 5 then
response.Write "</tr>"
Response.Write "<tr>"
rCount = 0
End If

if lCount = 10 then
lcount = 0

Response.Write "</td>"
Response.Write "</table>"
Response.Write "<div align=""center"">"
If recCount > 10 then
%>
<a href="#<%Response.Write (nameCount - 10)%>"><img src="arrows/arr_left.gif"></a>
<%
End If
Response.Write recCount
Response.Write "&nbsp;"
Response.Write "Of"
Response.Write "&nbsp;"
Response.Write objRS.RecordCount
recResult = objRS.RecordCount - recCount
If recResult >= 10 then
nameCount = recCount
%>
<a href="#<%Response.Write nameCount%>"><img src="arrows/arr_right.gif"></a>
<%
End If
If recResult <= 10 then
%>
<a href="#<%Response.Write (nameCount + 10)%>"><img src="arrows/arr_right.gif"></a>
<%
End if
'Response.Write "<p>&nbsp;</p>"
'Response.Write "<p>&nbsp;</p>"
'Response.Write "<p>&nbsp;</p>"
'Response.Write "<p>&nbsp;</p>"
'Response.Write "<p>&nbsp;</p>"
'Response.Write "<p>&nbsp;</p>"
'Response.Write "<p>&nbsp;</p>"
'Response.Write "<p>&nbsp;</p>"
'Response.Write "<p>&nbsp;</p>"
'Response.Write "<p>&nbsp;</p>"
'Response.Write "<p>&nbsp;</p>"
'Response.Write "<p>&nbsp;</p>"
'Response.Write "<p>&nbsp;</p>"
'Response.Write "<p>&nbsp;</p>"
'Response.Write "<p>&nbsp;</p>"
%>
<a name="<%Response.Write recCount%>"></a>
<%
Response.Write "<table width=""10%"" border=""1"" align=""center"">"
Response.Write "<tr>"
Response.Write "<div align=""center"">"
End If

recCount = recCount + 1
objRS.MoveNext

Loop

Response.Write "</table>"
If recCount > 10 Then
%>
<a href="#<%Response.Write (nameCount)%>"><img src="arrows/arr_left.gif"></a>
<%
Response.Write "Back"
End If

objRS.Close
set objRS = Nothing

objConn.Close
set objConn = Nothing
%>
frik is offline
Reply With Quote
View Public Profile Visit frik's homepage!
 
Old 09-30-2004, 06:05 PM
Kyrnt's Avatar
The Post-Mod Years

Posts: 2,536
Location: Western Maryland
And when you say it is not working -- what problem are you getting? Is the problem that it is putting all the results on the same page?

What I do see is that you are trying to put only 10 rows on a page and that's fine. But where are you tracking the number of messages you are skipping to get to this page? For example, if you have 5 pages and this is page 3, where is the logic where you are skipping the records on page 1 and 2?

Hmmm, do you have this code running on the net yet even in testing? It would help to be able to see it running. I think we can solve the problem.
__________________
—Kyrnt
Kyrnt is offline
Reply With Quote
View Public Profile Visit Kyrnt's homepage!
 
Old 10-01-2004, 07:29 AM Logic
frik's Avatar
Average Talker

Posts: 26
Location: SOuth Africa
This is where my problem is. I dont know how to say after the first 10 line "You are finished now and you must go to another page"
frik is offline
Reply With Quote
View Public Profile Visit frik's homepage!
 
Reply     « Reply to Dynamic Pages
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 1.42396 seconds with 12 queries