This is a forum where members new and old can come to ask questions and get info and opinions. It is not a place to advertise your business or have other forms of advertising, whether it be in your posts or signature.

All links in the forum will not be indexed by Search Engines and any unapproved forms of advertising or spam will be dealt with accordingly, deleted, and that member's account banned.

Forums

Overview » ASP » Search results showing way to many results
Reply

Search results showing way to many results

andy bertaut
Freaking Member



Since: 28 May 2005
Posts: 52
Posted 08 Nov 2005 12:47:52

Hi Guys
I have a search page here:
d1956485.u35.hosting365.ie/asp/search.asp
When I perform a search the results page here:
d1956485.u35.hosting365.ie/asp/search_results.asp
displays results that have nothing to do with the search. I have the recordset set to Form variable, the filtering on "Contains". I cannot figure this one out. I have done this so many times and it's so easy but this one refuses to work. If anyone can spot anything in the code, I'd be a happy man.
Cheers
Andy

Hi Guys
I have a search page here:
d1956485.u35.hosting365.ie/asp/search.asp
When I perform a search the results page here:
d1956485.u35.hosting365.ie/asp/search_results.asp
displays results that have nothing to do with the search. I have the recordset set to Form variable, the filtering on "Contains". I cannot figure this one out. I have done this so many times and it's so easy but this one refuses to work. If anyone can spot anything in the code, I'd be a happy man.
Cheers
Andy
Michael Behan
Freaking Member



Since: 22 Jan 2005
Posts: 71
Replied 08 Nov 2005 13:47:24
from my couple of test searches it seems to always return everything.

so it could be just something small in the name of the search field or where you use that in your recordset on the next page.

if you post the code for the recordset here it will make it a bit easier to see exactly whats wrong.
andy bertaut
Freaking Member



Since: 28 May 2005
Posts: 52
Replied 08 Nov 2005 13:52:42
I should have done this from the off...here is the code for the recordset:

<%
var rsSEARCH = Server.CreateObject("ADODB.Recordset";
rsSEARCH.ActiveConnection = MM_connSLEVIN_STRING;
rsSEARCH.Source = "SELECT ProductCode, Name, Brochuredescription FROM slevin_site WHERE Brochuredescription LIKE '%"+ rsSEARCH__MMColParam.replace(/'/g, "''" + "%'";
rsSEARCH.CursorType = 0;
rsSEARCH.CursorLocation = 2;
rsSEARCH.LockType = 1;
rsSEARCH.Open();
var rsSEARCH_numRows = 0;
%>
Michael Behan
Freaking Member



Since: 22 Jan 2005
Posts: 71
Replied 08 Nov 2005 14:39:40
can you also show the bit of code (usually appears just above the recordset code) that defines rsSEARCH__MMColParam

i reckon the problem will be to do with that.
andy bertaut
Freaking Member



Since: 28 May 2005
Posts: 52
Replied 08 Nov 2005 17:46:42
here ya go, thanks for the feedback:

<%
var rsSEARCH__MMColParam = "1";
if (String(Request.Form("SearchForm") != "undefined" &&
String(Request.Form("SearchForm") != "" {
rsSEARCH__MMColParam = String(Request.Form("SearchForm");
}
%>

SearchForm is the name of the form the users use to search for products
Michael Behan
Freaking Member



Since: 22 Jan 2005
Posts: 71
Replied 08 Nov 2005 18:27:48
you have to use the name of the form field rather than the form itself.

So if you change SearchForm to Search (I think this is what you called the search field) it should work.
andy bertaut
Freaking Member



Since: 28 May 2005
Posts: 52
Replied 09 Nov 2005 15:33:23
did u ever finally get it right and groan at your own stupidity???? Thanks Micheal, the second I read that i realised you were right and proceeded to call myself every idiot under the sun.
Michael Behan
Freaking Member



Since: 22 Jan 2005
Posts: 71
Replied 10 Nov 2005 00:49:34
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>did u ever finally get it right and groan at your own stupidity????<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
YES! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Sometimes the simplest mistakes are the hardest ones to spot

Reply to this topic

Message
Reply
Follow us on Facebook Follow us on twitter Subscribe to the RSS feed
Activate your free membership today | Login | Currency