hejsan,
alltsa det jag inte fattar e hur skall jag kunan skriva ut pagingen innan jag gor en count pa produkterna i databasen?? pagingen funkar i slutet da jag har skrivit ut alla produkter men inte innan!
<%'Response.Write "<font size=1><br><br>You are at page <b>"&intPage&"</b> of "&intPageCount&"</font><br /><font size=2>Go To Page </font>"
'Response.Write "<br>Go To Page: "
For intNum = 1 To intPageCount
Response.Write "| <a href=listProdNew.asp?q="&Request.Querystring("q")&"&sortBy="&Request.Querystring("sortBy")&"&page=" & intNum & ">" & intNum & "</a> "
Next
response.write"|"
response.write " [next] "
response.write "[last]"
%>
</td>
</tr>
</tbody>
</table>
<table cellSpacing="0" cellPadding="0" width="732" border="0">
<tbody>
<tr>
<td bgColor="#ffffff"><img height="4" src="img/clear.gif" width="1" border="0"></td>
</tr>
<tr>
<td bgColor="#eaeaea"><img src="img/clear.gif" border="0" width="1" height="1"></td>
</tr>
</tbody>
</table>
<br>
<table cellSpacing="0" cellPadding="5" width="893" border="0">
<tbody>
<tr>
<td vAlign="top" align="left" width="726" height="104" rowspan="2" >
<table border="0" width="100%" cellspacing="0" cellpadding="0" class="smallText">
<tr>
<td width="15%" valign="top"><b>Sort By</b><br>
<a href="listProdNew.asp?q=<%=Request.Querystring("q")%>&sortBy=Price">Price</a><br>
<br>
<b>Filer By</b><br>
<a href="listProdNew.asp?q=<%=Request.Querystring("q")%>+white+gold">White Gold</a><br>
<a href="listProdNew.asp?q=<%=Request.Querystring("q")%>+platinum">Platinum</a><br>
<a href="listProdNew.asp?q=<%=Request.Querystring("q")%>+gold">Yellow Gold</a><br></td>
<td width="85%">
<table cellSpacing="0" cellPadding="1" width="100%" border="0">
<tbody>
<tr>
<!-- loop -->
<%
'0=======================================
'0========Shows the selected products=========
'0=======================================
Set Conn = Server.CreateObject("ADODB.Connection")
Set rs=Server.CreateObject("ADODB.Recordset")
Conn.Open "xxx", "xxx", "xxx"
sortBy = Request.Querystring("sortBy")
if sortBy <> "" then
sortBy = Request.Querystring("sortBy")
else
sortBy = "ID"
end if
arrWords=split(request.querystring("q")," ")
strWhere=""
for each strWord in arrWords
if strWord<>"" then
if strWhere<>"" then strWhere = strWhere & " AND "
strWord=replace(strWord,"'","''")
strWhere= strWhere & " (productItemId LIKE '%" & strWord & "%' OR " &_
" design LIKE '%" & strWord & "%' OR " &_
" smalldesc LIKE '%" & strWord & "%' OR " &_
" productTypeID LIKE '%" & strWord & "%' OR " &_
" productCategoryID LIKE '%" & strWord & "%' OR " &_
" catalogID LIKE '%" & strWord & "%' OR " &_
" name LIKE '%" & strWord & "%')"
end if
next
if strWhere<>"" then strWhere = " WHERE " & strWhere
sql = "SELECT * FROM productItem " & strWhere & " order by " & sortBy & " ASC"
'set rs = Conn.execute(sql)
'response.write sql
rs.Open sql, Conn, 3, 3
intPage = Request.QueryString("page")
If isNumeric(intPage) = False Or intPage < 1 Then
intPage = 1
End If
'if NOT rs.eof then
if rs.eof then
response.write "<font size=2>No standard items containing all your search terms were found.</font><br><br>"
response.write "<font size=2>Your search - <b>"&request.querystring("q")&"</b> - did not match any documents.</font><br><br>"
response.write "<font size=2>Suggestions:<br><br>"
response.write "- Make sure all words are spelled correctly.<br>"
response.write "- Try different keywords.<br>"
response.write "- Try more general keywords.<br>"
response.write "- Try fewer keywords.</font>"
else
rs.PageSize = 12 'Number of item in one page
rs.AbsolutePage = intPage
intRecCount = rs.PageSize
intPageCount = rs.PageCount
intCounter = 0
Do While Not rs.EOF And intRecCount > 0
intRecCount = intRecCount - 1
intCounter = intCounter + 1
%>
och sedan kan jag inte fa next och previous lankarna att funka, skulle va tacksam for hjalp...