Search results showing way to many results

Author Topic
andy bertaut
Freaking Member

Joined: 28 May 2005
Country:
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

Michael Behan

Joined: 22 Jan 2005
Country: Ireland
Posts: 71

Posted: 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.

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

Joined: 28 May 2005
Country:
Posts: 52

Posted: 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;
%>

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

Michael Behan

Joined: 22 Jan 2005
Country: Ireland
Posts: 71

Posted: 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.

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

Joined: 28 May 2005
Country:
Posts: 52

Posted: 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

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

Michael Behan

Joined: 22 Jan 2005
Country: Ireland
Posts: 71

Posted: 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.

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

Joined: 28 May 2005
Country:
Posts: 52

Posted: 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.

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

Michael Behan

Joined: 22 Jan 2005
Country: Ireland
Posts: 71

Posted: 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

<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
Follow us on twitter Subscribe to our RSS feed
Activate your free membership today | Login | Currency