Forums
This topic is locked
Quick search error
Posted 14 May 2006 22:36:49
1
has voted
14 May 2006 22:36:49 martin else posted:
Hi,I am not spaming anyone but in order to see what I mean you might have to look at my test site to help me. www.autos.sell2make.eu
What happens is....
I get on my home page , I click on the quick search on the far right hand side and do a search for cars . ( to help me you must search the same specifics as I have because that is the area I have listed all my cars )
I click on quick search as I said and then I select Acura, then I select CL.
I get a list of 10 cars come up.
When I click " next " or " Last "to go over to the next page to find more results I get a message saying " NO RECORDS FOUND " even though I have 24 listings to search from.
No matter what I have tried I cannot seem to fix it. Can anyone please hellllpppp me?
This is the code for the whole result.asp page. I will appreciate anyones help. Thank you in advance
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Server.ScriptTimeout = 360 %>
<%
' *** Logout the current user.
MM_Logout = CStr(Request.ServerVariables("URL") & "?MM_Logoutnow=1"
If (CStr(Request("MM_Logoutnow") = "1" Then
Session.Abandon
MM_logoutRedirectPage = "default.asp"
' redirect with URL parameters (remove the "MM_Logoutnow" query param).
if (MM_logoutRedirectPage = "" Then MM_logoutRedirectPage = CStr(Request.ServerVariables("URL")
If (InStr(1, UC_redirectPage, "?", vbTextCompare) = 0 And Request.QueryString <> "" Then
MM_newQS = "?"
For Each Item In Request.QueryString
If (Item <> "MM_Logoutnow" Then
If (Len(MM_newQS) > 1) Then MM_newQS = MM_newQS & "&"
MM_newQS = MM_newQS & Item & "=" & Server.URLencode(Request.QueryString(Item))
End If
Next
if (Len(MM_newQS) > 1) Then MM_logoutRedirectPage = MM_logoutRedirectPage & MM_newQS
End If
Response.Redirect(MM_logoutRedirectPage)
End If
%>
<!--#include file="Connections/conn.asp" -->
<%
Dim rsSearch__MMCOLPARAM1
rsSearch__MMCOLPARAM1 = "1"
If (Request.form("make" <> "" Then
rsSearch__MMCOLPARAM1 = Request.form("make"
End If
%>
<%
Dim rsSearch__MMCOLPARAM2
rsSearch__MMCOLPARAM2 = "1"
If (Request.form("model" <> "" Then
rsSearch__MMCOLPARAM2 = Request.form("model"
End If
%>
<%
set rsSearch = Server.CreateObject("ADODB.Recordset"
rsSearch.ActiveConnection = MM_conn_STRING
rsSearch.Source = "SELECT * FROM AutoAds,AD_IMAGES,autoCATS,autoSUBS WHERE autoads.CAT_ID =" + Replace(rsSearch__MMCOLPARAM1, "'", "''" + " AND autoads.SUB_ID=" + Replace(rsSearch__MMCOLPARAM2, "'", "''" + " AND AD_APPROVED = 1 AND autoads.cat_id=autocats.cat_id and autoads.sub_id= autosubs.sub_id and autoads.ad_id=ad_images.ad_id and AD_EXPIRED > DATE() ORDER BY AD_DATED desc"
rsSearch.CursorType = 0
rsSearch.CursorLocation = 2
rsSearch.LockType = 3
rsSearch.Open()
rsSearch_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = 10
Repeat1__index = 0
rsSearch_numRows = rsSearch_numRows + Repeat1__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim rsSearch_total
Dim rsSearch_first
Dim rsSearch_last
' set the record count
rsSearch_total = rsSearch.RecordCount
' set the number of rows displayed on this page
If (rsSearch_numRows < 0) Then
rsSearch_numRows = rsSearch_total
Elseif (rsSearch_numRows = 0) Then
rsSearch_numRows = 1
End If
' set the first and last displayed record
rsSearch_first = 1
rsSearch_last = rsSearch_first + rsSearch_numRows - 1
' if we have the correct record count, check the other stats
If (rsSearch_total <> -1) Then
If (rsSearch_first > rsSearch_total) Then
rsSearch_first = rsSearch_total
End If
If (rsSearch_last > rsSearch_total) Then
rsSearch_last = rsSearch_total
End If
If (rsSearch_numRows > rsSearch_total) Then
rsSearch_numRows = rsSearch_total
End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
If (rsSearch_total = -1) Then
' count the total records by iterating through the recordset
rsSearch_total=0
While (Not rsSearch.EOF)
rsSearch_total = rsSearch_total + 1
rsSearch.MoveNext
Wend
' reset the cursor to the beginning
If (rsSearch.CursorType > 0) Then
rsSearch.MoveFirst
Else
rsSearch.Requery
End If
' set the number of rows displayed on this page
If (rsSearch_numRows < 0 Or rsSearch_numRows > rsSearch_total) Then
rsSearch_numRows = rsSearch_total
End If
' set the first and last displayed record
rsSearch_first = 1
rsSearch_last = rsSearch_first + rsSearch_numRows - 1
If (rsSearch_first > rsSearch_total) Then
rsSearch_first = rsSearch_total
End If
If (rsSearch_last > rsSearch_total) Then
rsSearch_last = rsSearch_total
End If
End If
%>
<%
' *** Move To Record and Go To Record: declare variables
Dim MM_rs
Dim MM_rsCount
Dim MM_size
Dim MM_uniqueCol
Dim MM_offset
Dim MM_atTotal
Dim MM_paramIsDefined
Dim MM_param
Dim MM_index
Set MM_rs = rsSearch
MM_rsCount = rsSearch_total
MM_size = rsSearch_numRows
MM_uniqueCol = "AD_ID"
MM_paramName = "id"
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> "" Then
MM_paramIsDefined = (Request.QueryString(MM_paramName) <> ""
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter
if (Not MM_paramIsDefined And MM_rsCount <> 0) then
' use index parameter if defined, otherwise use offset parameter
MM_param = Request.QueryString("index"
If (MM_param = "" Then
MM_param = Request.QueryString("offset"
End If
If (MM_param <> "" Then
MM_offset = Int(MM_param)
End If
' if we have a record count, check if we are past the end of the recordset
If (MM_rsCount <> -1) Then
If (MM_offset >= MM_rsCount Or MM_offset = -1) Then ' past end or move last
If ((MM_rsCount Mod MM_size) > 0) Then ' last page not a full repeat region
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If
' move the cursor to the selected record
MM_index = 0
While ((Not MM_rs.EOF) And (MM_index < MM_offset Or MM_offset = -1))
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
If (MM_rs.EOF) Then
MM_offset = MM_index ' set MM_offset to the last possible record
End If
End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range
If (MM_rsCount = -1) Then
' walk to the end of the display range for this page
MM_index = MM_offset
While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
' if we walked off the end of the recordset, set MM_rsCount and MM_size
If (MM_rs.EOF) Then
MM_rsCount = MM_index
If (MM_size < 0 Or MM_size > MM_rsCount) Then
MM_size = MM_rsCount
End If
End If
' if we walked off the end, set the offset based on page size
If (MM_rs.EOF And Not MM_paramIsDefined) Then
If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
If ((MM_rsCount Mod MM_size) > 0) Then
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If
' reset the cursor to the beginning
If (MM_rs.CursorType > 0) Then
MM_rs.MoveFirst
Else
MM_rs.Requery
End If
' move the cursor to the selected record
MM_index = 0
While (Not MM_rs.EOF And MM_index < MM_offset)
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
End If
%>
<%
' *** Move To Record: update recordset stats
' set the first and last displayed record
rsSearch_first = MM_offset + 1
rsSearch_last = MM_offset + MM_size
If (MM_rsCount <> -1) Then
If (rsSearch_first > MM_rsCount) Then
rsSearch_first = MM_rsCount
End If
If (rsSearch_last > MM_rsCount) Then
rsSearch_last = MM_rsCount
End If
End If
' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links
Dim MM_keepMove
Dim MM_moveParam
Dim MM_moveFirst
Dim MM_moveLast
Dim MM_moveNext
Dim MM_movePrev
Dim MM_urlStr
Dim MM_paramList
Dim MM_paramIndex
Dim MM_nextParam
MM_keepMove = MM_keepBoth
MM_moveParam = "index"
' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size > 1) Then
MM_moveParam = "offset"
If (MM_keepMove <> "" Then
MM_paramList = Split(MM_keepMove, "&"
MM_keepMove = ""
For MM_paramIndex = 0 To UBound(MM_paramList)
MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=" - 1)
If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then
MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)
End If
Next
If (MM_keepMove <> "" Then
MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
End If
End If
End If
' set the strings for the move to links
If (MM_keepMove <> "" Then
MM_keepMove = MM_keepMove & "&"
End If
MM_urlStr = Request.ServerVariables("URL" & "?" & MM_keepMove & MM_moveParam & "="
MM_moveFirst = MM_urlStr & "0"
MM_moveLast = MM_urlStr & "-1"
MM_moveNext = MM_urlStr & CStr(MM_offset + MM_size)
If (MM_offset - MM_size < 0) Then
MM_movePrev = MM_urlStr & "0"
Else
MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)
End If
%>
<!--#include file="inc_header.asp" --><!--#include file="inc_nav.asp" -->
<a href="default.asp" class="menu">Home </a>» <span class="menu"><strong>Quick Search Result</strong></span><span class="menu"></span>
<div align="right"> </div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="90%" height="0" valign="top"> <table width="97%" height="0" border="0" align="center" cellpadding="0" cellspacing="0">
<tr valign="top">
<td><table width="98%" border="0" align="center" cellpadding="1" cellspacing="0" >
<tr>
<td height="524" valign="top" >
<% If rsSearch.EOF And rsSearch.BOF Then %>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center"><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>NO
RECORDS FOUND ! </strong></font></div></td>
</tr>
</table>
<% End If ' end rsSearch.EOF And rsSearch.BOF %>
<% If Not rsSearch.EOF Or Not rsSearch.BOF Then %>
<form action="compareAuto.asp" method="post" name="phCh" id="phCh">
<font color="#003300"> </font>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0" >
<tr valign="middle" >
<td width="30%" height="20" colspan="2" align="center" >
<font color="#006699"><strong>
<table border="0" width="100%" align="center">
<tr>
<td width="10%" align="center"> <strong><font color="#006699">
<% If MM_offset <> 0 Then %>
<a href="<%=MM_moveFirst%>" class="link1"><<First</a>
<% End If ' end MM_offset <> 0 %>
</font></strong></td>
<td width="8%" align="center"> <strong><font color="#006699">
<% If MM_offset <> 0 Then %>
<a href="<%=MM_movePrev%>" class="link1"><Previous</a>
<% End If ' end MM_offset <> 0 %>
</font></strong></td>
<td width="69%" align="center"><div align="center" class="menu"><strong>Viewing:
[<%=(rsSearch_first)%> to <%=(rsSearch_last)%>
of <%=(rsSearch_total)%>]</strong></div></td>
<td width="6%" align="center"> <strong><font color="#006699">
<% If Not MM_atTotal Then %>
<a href="<%=MM_moveNext%>" class="link1">Next></a>
<% End If ' end Not MM_atTotal %>
</font></strong></td>
<td width="7%" align="center"> <strong><font color="#006699">
<% If Not MM_atTotal Then %>
<a href="<%=MM_moveLast%>" class="link1">Last>></a>
<% End If ' end Not MM_atTotal %>
</font></strong></td>
</tr>
</table>
</strong></font></td>
</tr>
<tr valign="middle" >
<td height="20" colspan="2" align="center"><div align="right"><strong><font color="#333333" size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name=compare type=button class="Buttons" onClick="if (Validate(this.form)) {submit();}" value=Compare>
<input name=clear type=reset class="Buttons" value=Clear>
</font></strong> </div></td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsSearch.EOF))
%>
<tr align="center" valign="middle" bgcolor="#E1E1E1">
<td height="20" colspan="2" background="img/bkgTitle.gif" class="title3"><div align="left" class="title"><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><font color="#FFFFFF" size="2"><a href="carDetail.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "AD_ID=" & rsSearch.Fields.Item("AD_ID".Value %>" class="title2" ><strong><%=(rsSearch.Fields.Item("AD_TITLE".Value)%></strong></a></font></font></font></div>
<div align="right"><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong><font size="2"></font></strong></font><font size="2"></font></strong></font></div></td>
</tr>
<tr align="center" valign="middle" >
<td height="137" align="left" valign="top" > <div class = "links">
<table width="95%" height="100" border="0" cellpadding="2" cellspacing="2">
<tr>
<td width="8" align="center" valign="top"><font color="#003300">
<input name="adID" type="checkbox" id="adID3" value="<%=(rsSearch.Fields.Item("AD_ID".Value)%>">
</font></td>
<td width="180" align="center" valign="middle">
<p align="left"><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><span class="title3"><strong><%=(rsSearch.Fields.Item("YEAR".Value)%>,
<%=(rsSearch.Fields.Item("CAT_NAME".Value)%>
- <%=(rsSearch.Fields.Item("SUB_NAME".Value)%>
</strong></span><br>
<span class="content2"><%=(rsSearch.Fields.Item("EDITION".Value)%>
Edition - </span></font><span class="content2"><font face="Verdana, Arial, Helvetica, sans-serif"><%=Cur%><%=FormatNumber((rsSearch.Fields.Item("AD_PRICE".Value),2)%><br>
</font><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">
<% =(CropSentence((rsSearch.Fields.Item("AD_DESCRIPTION".Value), 150, "...") %>
</font></span></p>
<p align="left"><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="carDetail.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "AD_ID=" & rsSearch.Fields.Item("AD_ID".Value %>" class="link1"><strong><img src="img/point3.gif" width="11" height="13" border="0"><span class="link1">more...</span></strong></a><br>
</font></p>
<font size="1" face="Verdana, Arial, Helvetica, sans-serif">
</font></td>
</tr>
</table>
</div></td>
<td valign="top" ><div align="right">
<p align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<%if rsSearch.Fields.Item("IMAGE1".Value = "" Then %>
<a href="carDetail.asp?make_id=<%=(rsSearch.Fields.Item("CAT_ID".Value)%>&model_id=<%=(rsSearch.Fields.Item("SUB_ID".Value)%>&ad_id=<%=(rsSearch.Fields.Item("AD_ID".Value)%>"><img src="images/nopic.jpg" width="150" height="100" border="0"></a>
<%else%>
<a href="carDetail.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "AD_ID=" & rsSearch.Fields.Item("AD_ID".Value %>"><img src="images/<%=(rsSearch.Fields.Item("IMAGE1".Value)%>" width="140" height="105" border="0"></a>
<%end if %>
</font><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">
</font></p>
</div></td>
</tr>
<tr align="center" valign="middle" >
<td colspan="2" align="left" valign="top" ><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td background="img/helpers/line_bkg.gif"><img src="img/helpers/spacer.gif" width="10" height="1"></td>
</tr>
</table></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsSearch.MoveNext()
Wend
%>
</table>
</form>
<% End If ' end Not rsSearch.EOF Or NOT rsSearch.BOF %>
<p> </p></td>
</tr>
</table></td>
</tr>
<tr valign="top">
<td> </td>
</tr>
</table></td>
<td width="15" valign="top">
<!--#include file="inc_side.asp" -->
</table>
<!--#include file="inc_footer.asp" -->
<%
rsSearch.Close()
%>
www.sell2make.com
Replies
Replied 14 May 2006 22:43:15
14 May 2006 22:43:15 martin else replied:
Sorry for putting the code form the whole page there its just im new to asp and am not too sure as to where the problem may be. But I think it is around 40 ish . Sorry about that. I think its around the 40 th line. But like I say im not usre at all.
www.sell2make.com
Edited by - martinn12005 on 14 May 2006 22:51:24
www.sell2make.com
Edited by - martinn12005 on 14 May 2006 22:51:24