View Full Version : Out of memory
BarrMan
12-08-2005, 09:22 PM
Can anyone see what is wrong here?
its not a problem of too many results because i've entered a word that never apprears in my threads.
<%Dim word, Tarray(), Barray(), Count, msg, size
Count = 0
size = 0
word = Request.Form("word")
If Request.Form("forum") = "allforums" Then
For i = 1 To 16
If Request.Form("option") = "both" Then
SQL = "SELECT * FROM forum#" & i & " WHERE title LIKE '%" & word & "%' OR body like '%" & word & "%'"
rs.open SQL, Conn, 3, 3
size = size + (rs.RecordCount - 1)
Redim Preserve Tarray(size)
Redim Preserve Barray(size)
While Not rs.EOF
Tarray(Count) = rs("title")
Barray(Count) = rs("body")
Count = Count + 1
rs.MoveNext
Wend
rs.Close
End If
Next
End If%>
vinyl-junkie
12-09-2005, 05:02 AM
Are you getting an error message or what? It isn't clear from your post.
BarrMan
12-09-2005, 05:22 AM
yes i'm getting an error message: "Out of memory"
BarrMan
12-09-2005, 05:17 PM
Thanks for the help TheShaner!
Solved the problem without using arrays because they weren't necessary.
Here is the fixed code:
<%
Function strHighlight(str)
If IsEmpty(str) or IsNull(str) Then Exit Function
str = Replace(str,word,"<b>" & word & "</b>")
strHighlight = str
End Function
If Request.QueryString("s") = 1 Then
%>
<b>Search results</b></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>
<%
Dim word, forum, foption
forum = Request.Form("forum")
foption = Request.Form("option")
word = Request.Form("word")
If forum = "allforums" 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
While Not rs.EOF
%>
<tr><td height="30px"><a title="<%=rs("body")%>" href="showthread.asp?id=<%=rs("id")%>&fID=<%=Request.QueryString("id")%>"><%=strHighlight(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>
<%
rs.MoveNext
Wend
rs.Close
Next
Response.Write "</table></td></tr>"
ElseIf forum <> "" And forum <> "allforums" 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
%>
<tr><td height="30px"><a title="<%=rs("body")%>" href="showthread.asp?id=<%=rs("id")%>&fID=<%=Request.QueryString("id")%>"><%=strHighlight(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>
<%
End If
vBulletin® v3.8.2, Copyright ©2000-2010, Jelsoft Enterprises Ltd.