Closed Thread Icon

Topic awaiting preservation: Page never go to next problem(ASP) (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12976" title="Pages that link to Topic awaiting preservation: Page never go to next problem(ASP) (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Page never go to next problem(ASP) <span class="small">(Page 1 of 1)</span>\

 
Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 11-12-2003 04:35

Hi, guys. How are you?
Please help me.
I have a serious problem.
I made shopping catalogue. It shows each product according to menu.
Menu has Pendants, Bangles, Collors and so on.
When user go to each items, I didn't want to show all the item on the same page.
I tried to show 7 each pages. And made page index at the bottom of the page.
It looked every fine. I am quite pleased until I clicked page 2.
Some reason, when I click page inex number whatever, it just stays on page 1.
Never go to another page.
That is the problem.

Here is my code:

code:
<html>
<head>
<title>Catalogue</title>
<link rel="stylesheet" type="text/css" href="../styles1/catalogue.css">
<link rel="stylesheet" type="text/css" href="../styles1/cata_menu.css">
</head>
<body>
<%'If Session("PW") ="" Then Response.Redirect("../login.htm")%>
<div id="menu">

<a href="Catalogue2a.asp?item=Collars">&nbsp;&nbsp;&nbsp;Collars</a><br />
<a href="Catalogue2a.asp?item=Bracelets">&nbsp;&nbsp;&nbsp;Bracelets</a><br />
<a href="Catalogue2a.asp?item=Bangles">&nbsp;&nbsp;&nbsp;Bangles</a><br />
<a href="Catalogue2a.asp?item=Pendants">&nbsp;&nbsp;&nbsp;Pendants </a><br />
<a href="Catalogue2a.asp?item=Earrings">&nbsp;&nbsp;&nbsp;Earrings</a><br />
<a href="Catalogue2a.asp?item=Rings">&nbsp;&nbsp;&nbsp;Rings</a><br />
<a href="Catalogue2a.asp?item=Necklace">&nbsp;&nbsp;&nbsp;Chain/Necklaces</a><br />
<a href="Catalogue2a.asp?item=Designer">&nbsp;&nbsp;&nbsp;Designer Pieces</a>
</div>
<%
' Declare our variables... always good practice!
Dim cnn ' ADO Connection
Dim rs ' ADO recordset
Dim x
Dim pg, psize,maxpages, maxrecs, recct,i

pg=Request("pg")
If pg = "" Then
pg = 1
End If

psize = Request("psize")
If psize = "" Then
psize = 7
End If

'this part decides what product is according to the choice of links
'if user come to this page, 'Collors' is the default.
Dim product
product = Request.QueryString("item")
If product="" then
product = "Collars"
else
product = Request.QueryString("item")
end if

ConnString = "Driver={Microsoft dBase Driver (*.dbf)}; DBQ =CATEGORY.dbf;DefaultDir=/home/sites/www.globalsilver.co.nz/web/LoginTest/DB"

Set cnn = Server.CreateObject("ADODB.Connection")
cnn.cursorlocation = 3
cnn.Open ConnString

'This is dynamic SQL
Set rs = cnn.Execute("SELECT * FROM CATEGORY WHERE CATEGORY='"&product&"'")
rs.pagesize = psize
maxpages = Int(rs.pagecount)
maxrecs = Int(rs.pagesize)
rs.absolutepage = pg
recct = 0
%>
<div id="catalogue">
<table align="center">
<tr><td style="font-size: 20px; color: #555;" colspan="3"><%=rs("CATEGORY").VALUE%></td><td colspan="3" align="right"><%Response.Write("Page" & pg & "&nbsp;of&nbsp;" & maxpages & "<br>")%></td></tr>

<%Do Until rs.EOF or recct >=maxrecs%>
<tr>
<% For each x in rs.Fields %>
<% 'For i = 0 to rs.Fields.count - 1%>
<%If x.name="CODE" Then%>
<td><img id="cat_bar" src="../assets/<%=product%>/<%Response.Write(x.value)%>"></td>
<%End If%>
<%If x.name <> "CATEGORY" Then%>
<td><% If x.name = "PRICE" Then Response.Write("$" & x.value) Else Response.Write(x.value) End IF %></td>
<%END IF%>
<%Next%>
<%rs.MoveNext
recct = recct + 1
%>
</tr>
<tr><td colspan="6"><img src="../assets/cat_bar.gif"></td></tr>
<%Loop%>


<tr><td align="center" colspan="6"><% If pg<>1 Then%>
<a class="page" href="Catalogue2a.asp?item=&product&?pg=<%=pg-1%> &psize=<%=psize%>">Previous</a>
<%End If%>
<%If pg-maxpages<>0 Then %>
<a class="page" href="Catalogue2a.asp?item=&product&?pg=<%=pg+1%> &psize=<%=psize%>">&nbsp;&nbsp;&nbsp;Next</a>
<%End If%>

<%
Response.write("<br>")

'Not sure about this. Just doesn't work this page index
For i=1 to maxpages
Response.write("<a href=""Catalogue2.asp?item=" & product &"&?pg=" & i & """ >" & i & "</a> ")
Next

%> </td></tr>
</table>
<%Response.write(i)%>
<%
rs.Close
Set rs = Nothing
cnn.Close
Set cnn = Nothing
%>
</div>
</body>
</html>



Hmm....Do you seem something wrong?
I guess something wrong with:

code:
For i=1 to maxpages
Response.write("<a href=""Catalogue2.asp?item=" & product &"&?pg=" & i & """ >" & i & "</a> ")
Next



Hmm...

Hiroki Kozai

Rhino
Bipolar (III) Inmate

From: New Jersey, USA
Insane since: Jul 2003

posted posted 11-12-2003 12:05

The code you have here

pg = Request("pg")

I would assume that you are not getting the value here and it is always setting it to 1. Instead change the statement to

pg = Request.QueryString("pg")

Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 11-13-2003 02:06

Thank you very much for your reply.
It was great help.
And I found this line wrong:

code:
("<a href=""Catalogue2.asp?item=" & product &"&[b]?[/b]pg=" & i & """ >" & i & "</a> ")



Then I changed to:

code:
("<a href=""Catalogue2.asp?item=" & product &"&pg=" & i & """ >" & i & "</a> ")



Now it is working fine.
Many many thanks.
Cheers.

Hiroki Kozai

« BackwardsOnwards »

Show Forum Drop Down Menu