PDA

View Full Version : from page 4> getting no matched results


BarrMan
12-10-2005, 09:02 PM
http://localhost/bestforums/forums.asp?s=1&page=4&w=thread&f=allforums&o=both
there are 48 pages with 10 records each, after the 4th page i don't get results at all when there should be results.
<%@ Language=VBScript %>
<!--#include file="includes/DBconn.asp"-->
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<link href="includes/style.css" rel="stylesheet" type="text/css">
<BODY>
<table width="700px" align="center" border="1">
<tr><td align="center" height="100px" colspan="6"><font color="green" size="10">Best Forums</font><br><font color="red" size="4">Everything you need</font></td></tr>
<tr><td colspan="4"><!--#include file="includes\menu.asp"--></td></tr>
<tr><td colspan="4" height="100px">
<table border="1"><tr>
<td align="center" width="230px" height="100px"><a href="AddAd.asp?p=1">Click here to add an<br> advertisement</a></td>
<td align="center" width="230px" height="100px"><a href="AddAd.asp?p=2">Click here to add an<br> advertisement</a></td>
<td align="center" width="230px" height="100px"><a href="AddAd.asp?p=3">Click here to add an<br> advertisement</a></td>
</tr></table></td></tr>
<tr><td colspan="2"><b>
<%
If Request.QueryString("s") = 1 Then
Dim PageSize, CurrentPage, PageCount, word, forum, foption, Counter, sCounter
Counter = 0
sCounter = 0
If Request.QueryString("page") = "" Then
CurrentPage = 1
Else
CurrentPage = Cint(Request.QueryString("page"))
End If
If Request.QueryString("f") = "" Then
forum = Request.Form("forum")
Else
forum = Request.QueryString("f")
End If
If Request.QueryString("o") = "" Then
foption = Request.Form("option")
Else
foption = Request.QueryString("o")
End If
If Request.QueryString("w") = "" Then
word = Request.Form("word")
Else
word = Request.QueryString("w")
End If
PageSize = 10
Rs.PageSize = PageSize
Rs.CacheSize = PageSize
If forum = "0" Then
For i = 1 To 16
If foption = "both" Then
SQL = "SELECT * FROM forum#" & i & " WHERE title LIKE '%" & word & "%' OR body LIKE '%" & word & "%'"
Else
SQL = "SELECT * FROM forum#" & i & " WHERE " & foption & " LIKE '%" & word & "%'"
End If
Rs.Open SQL, Conn, 3, 3
PageCount = PageCount + Rs.PageCount
Rs.Close
Next
Else
If foption = "both" Then
SQL = "SELECT * FROM forum#" & forum & " WHERE title LIKE '%" & word & "%' OR body LIKE '%" & word & "%'"
Else
SQL = "SELECT * FROM forum#" & forum & " WHERE " & foption & " LIKE '%" & word & "%'"
End If
Rs.Open SQL, Conn, 3, 3
PageCount = Rs.PageCount
Rs.Close
End If

Function HighlightText(str)
If IsEmpty(str) or IsNull(str) Then Exit Function
str = Replace(str,word,"<div id=HLT>" & word & "</div>")
HighlightText = str
End Function


%>
<b>Search settings: </b>
<%If forum = "0" Then
Response.Write "all the forums"
Else
Response.Write "forum# " & forum
End If

%></b></td></tr>
<tr><td><table>
<tr><td width="350px">Current page <b><%=CurrentPage%></b> of <b><%=PageCount%></b></td>
<td width="350px" align="right">
<%
If CurrentPage < 3 Then
If PageCount <= 5 Then
For i = 1 To PageCount
If i = CurrentPage Then
Response.Write i & VBCrlf
Else
Response.Write "<a href=forums.asp?s=1&page=" & i & "&w=" & word & "&f=" & forum & "&o=" & foption & ">" & i & "</a>" & VBcrlf
End If
Next
Else
For i = 1 To 5
If i = CurrentPage Then
Response.Write i & VBCrlf
Else
Response.Write "<a href=forums.asp?s=1&page=" & i & "&w=" & word & "&f=" & forum & "&o=" & foption & ">" & i & "</a>" & VBcrlf
End If
Next
End If
Else
If PageCount >= (CurrentPage + 2) Then
For i = (CurrentPage - 2) To (CurrentPage + 2)
If i = CurrentPage Then
Response.Write i & VBCrlf
Else
Response.Write "<a href=forums.asp?s=1&page=" & i & "&w=" & word & "&f=" & forum & "&o=" & foption & ">" & i & "</a>" & VBcrlf
End If
Next
Else
If PageCount >= 6 Then
For i = (PageCount - 5) To PageCount
If i = CurrentPage Then
Response.Write i & VBCrlf
Else
Response.Write "<a href=forums.asp?s=1&page=" & i & "&w=" & word & "&f=" & forum & "&o=" & foption & ">" & i & "</a>" & VBcrlf
End If
Next
Else
For i = 1 To PageCount
If i = CurrentPage Then
Response.Write i & VBCrlf
Else
Response.Write "<a href=forums.asp?s=1&page=" & i & "&w=" & word & "&f=" & forum & "&o=" & foption & ">" & i & "</a>" & VBcrlf
End If
Next
End If
End If
End If
%>
</td></tr></table></td></tr>
<tr><td><table border="1"><tr><td width="350px" align="center"><b>Title</b></td>
<td align="center" width="150px"><b>Writer</b></td>
<td align="center" width="150px"><b>Last Reply</b></td>
<td align="center" width="25px"><b>Views</b></td>
<td align="center" width="25px"><b>Replys</b></td></tr>
<%
If forum = "0" Then
For i = 1 To 16
If foption = "both" Then
SQL = "SELECT * FROM forum#" & i & " WHERE title LIKE '%" & word & "%' OR body like '%" & word & "%'"
ElseIf foption = "title" Or foption = "body" Then
SQL = "SELECT * FROM forum#" & i & " WHERE " & foption & " LIKE '%" & word & "%'"
End If
rs.open SQL, Conn, 3, 3
Rs.AbsolutePage = CurrentPage
While Not rs.EOF And Counter < PageSize
%>
<tr><td height="30px"><a title="<%=rs("body")%>" href="showthread.asp?id=<%=rs("id")%>&fID=<%=Request.QueryString("id")%>"><%=HighlightText(rs("Title"))%></a></td>
<td align="center" height="30px"><b><%=rs("username")%></b><br><%=rs("date")%></td>
<td align="center" height="30px"><b><%=rs("LastReply")%></b><br><%=rs("lastReplyDate")%></td>
<td align="center" height="30px"><%=rs("Views")%></td>
<td align="center" height="30px"><%=rs("replys")%></td></tr>
<%
Counter = Counter + 1
rs.MoveNext
Wend
rs.Close
Next
Response.Write "</table></td></tr>"
ElseIf forum <> "" And forum <> "0" Then
If foption = "both" Then
SQL = "SELECT * FROM forum#" & forum & " WHERE title LIKE '%" & word & "%' OR body LIKE '%" & word & "%'"
ElseIf foption = "title" Or foption = "body" Then
SQL = "SELECT * FROM forum#" & forum & " WHERE " & foption & " LIKE '%" & word & "%'"
End If
Rs.Open SQL, Conn, 3, 3
While Not Rs.EOF
%>
<tr><td height="30px"><a title="<%=rs("body")%>" href="showthread.asp?id=<%=rs("id")%>&fID=<%=Request.QueryString("id")%>"><%=HighlightText(rs("Title"))%></a></td>
<td align="center" height="30px"><b><%=rs("username")%></b><br><%=rs("date")%></td>
<td align="center" height="30px"><b><%=rs("LastReply")%></b><br><%=rs("lastReplyDate")%></td>
<td align="center" height="30px"><%=rs("Views")%></td>
<td align="center" height="30px"><%=rs("replys")%></td></tr>
<%
Counter = Counter + 1
Rs.Movenext
Wend
Rs.Close
End If
If Counter = 0 Then
%>
<tr><td colspan="5" height="30" align="center"><b>No matched results</b></td></tr></table>
<%
End If
Else
%>
<b>forum name</b>
</td></tr>
<%
Dim i
For i = 1 To 16
%>
<tr><td height="50px"><a href="showforum.asp?id=<%=i%>">Forum#<%=i%></a></td></tr>
<%Next%>
<%End If%>
</table>
</BODY>
</HTML>

BarrMan
12-15-2005, 12:24 PM
Got any idea anyone?

BarrMan
12-16-2005, 10:07 AM
can any1 at least offer me some ways i can try to fix that?