navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

RE: search across multiple fields

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> RE: search across multiple fields
Page: <<   < prev  1 2 3 4 [5]
 
jonance

 

Posts: 297
From: Louisville KY USA
Status: offline

 
RE: search across multiple fields - 10/2/2003 11:29:18   
Okay...i've done some experimenting and this is what i have found:

the fp_sQry line is where our problem lies right now. On my search results page I went to that line and put in the following code:

quote:


fp_sQry="SELECT * FROM products WHERE ((Itemname Like '%::search::%') OR (brands Like '%::search::%') OR (category Like '%::search::%') OR (subcategory Like '%::search::%'))"


This is basically the same code that your 'myquery' code generates, EXCEPT it has the ::search:: part pull from the search form. The next button DOES work with this code. I then put this in:

quote:


fp_sQry="SELECT * FROM products WHERE ((Itemname Like '%deck%') OR (brands Like '%deck%') OR (category Like '%deck%') OR (subcategory Like '%deck%'))"


This is what your script generates if you do a search for "deck"...and it puts it right in the fp_sQry line. When i put this code in there, the next button DIDN'T work.

It seems the only way the next buttons can work is for the fp_sQry line to have the ::search:: variable in there, and it doesn't work if that is already filled in that line as our 'myquery' code apparently does. That may be able to be done if we can have your code process it as it does, but then turn it into a parameter. I could see that being possible when it is a one word search...but what about when two or more words are searched for? I'm not sure if that would work. Of course, i am not sure how to go about programming this but i thought you might have a better idea. This is definately the problem...now can we solve it? Let me know your thoughts and if this makes any sense to you at all.

Thanks,
John

(in reply to jonance)
jonance

 

Posts: 297
From: Louisville KY USA
Status: offline

 
RE: search across multiple fields - 10/2/2003 11:37:42   
So i suppose what may somehow need to be done is this, if possible:

1. populate the fp_sQry line so that is can still read parameters...so the query expression isn't already set, and make it be able to "build" the query itself, even with multiple words.

2. Have your query pull and each of the individual words typed in a search, and 'send' that info to the query line of fp_sQry so it can fill in the correct parameters. I suppose each word would have to be a diff. parameter (like ::search1::, ::search2::, etc.) so they can be distinguished??

Again, not sure if this is possible...but it appears that is why it doesn't work....
Otherwise a separate pagination coding might be required.....let mek now what you think. :)

Thanks,
John

(in reply to jonance)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: search across multiple fields - 10/2/2003 13:40:48   
Lookin into it now.

_____________________________


(in reply to jonance)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: search across multiple fields - 10/2/2003 15:31:54   
Refresh my memory? :)
I'm fatigued...

This only happens on the test page that goes back to itself.... right? :)

I created another mach-up on my site and it works fine when it goes from page 1 to page 2. Page 2 keeps on going as long as their are products left to display.

_____________________________


(in reply to jonance)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: search across multiple fields - 10/2/2003 16:27:58   
quote:

fp_sQry="SELECT * FROM products WHERE ((Itemname Like '%::search::%') OR (brands Like '%::search::%') OR (category Like '%::search::%') OR (subcategory Like '%::search::%'))"


I just tested this.
It works fine IF there is only one word.
I tried two words on my mach-up system, and I got nothing displayed.
I have a couple of ideas that I will be testing on my mach-up page I gave you the address too.

_____________________________


(in reply to jonance)
jonance

 

Posts: 297
From: Louisville KY USA
Status: offline

 
RE: search across multiple fields - 10/2/2003 16:50:59   
That is what i was afraid of....let me know if you find out anything...i worked for awhile today to try to figure this out but wound up going around in circles.

John

(in reply to jonance)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: search across multiple fields - 10/2/2003 16:53:06   
:)

_____________________________


(in reply to jonance)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: search across multiple fields - 10/2/2003 17:18:25   
John,

After performing some visual tests on the "search" variable, the value of the variable is getting lost when you click the NEXT button to go to the next page. It was what I originally thought.

The buttons on the bottom are not passing the value that the code segment generated. To test it yourself I added and extra line that displays the contents of the SEARCH variable right above the SQL (on the page). Notice how it is cleared when you click the NEXT button. The problem is that the value is not being passed back onto itself.

<%
Dim Keyw, keyt
Dim sort
Dim myquery
Dim myQuerystring
Response.Write("search = "&Request.Form ("search") &"<BR>")
if (Request.Form("search" ) <> "" AND Request.Form("search" ) <> " ") Then
Keyt = " SELECT * FROM SpecialsDatabase WHERE "
Keyw = split(Request.Form("search")," " )
myQuerystring = "((ProductType Like '%"&trim(Keyw(0))&"%')"
myQuerystring = myQuerystring & " OR (SubCategory Like '%"&trim(Keyw(0))&"%')"
myQuerystring = myQuerystring & " OR (ItemName Like '%"&trim(Keyw(0))&"%')"
myQuerystring = myQuerystring & " OR (Description Like '%"&trim(Keyw(0))&"%'))"
if uBound(Keyw) > 0 Then
for i = 1 to uBound(Keyw)
myQuerystring = myQuerystring & " AND"
myQuerystring = myQuerystring & " ((ProductType Like '%"&trim(Keyw(i))&"%')"
myQuerystring = myQuerystring & " OR (SubCategory Like '%"&trim(Keyw(i))&"%')"
myQuerystring = myQuerystring & " OR (ItemName Like '%"&trim(Keyw(i))&"%')"
myQuerystring = myQuerystring & " OR (Description Like '%"&trim(Keyw(i))&"%'))"
next
end if
Keyw = Keyt + myQuerystring
myquery = Keyw
response.write myquery
%>


Now to solve it.......................

_____________________________


(in reply to jonance)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: search across multiple fields - 10/2/2003 23:17:30   
John,

Well, I think we've come to the end of that brown-dirt trail....
Another night has gone by and I cannot solve this issue.
Talk to your client - I think you have a serious decision to make.
You could:

1): Make the page one long search page.
2): Make it a two page search like I do / did.
3): Try to re-post the question.


You already know how to make it one long search page right? If you decide on 2, that is much easier than what your trying to do now.

Sorry I could be of no more help. :)
LLLuneeeee :)

< Message edited by Long Island Lune -- 10/3/2003 12:39:33 PM >


_____________________________


(in reply to jonance)
Page:   <<   < prev  1 2 3 4 [5]

All Forums >> Web Development >> ASP and Database >> RE: search across multiple fields
Page: <<   < prev  1 2 3 4 [5]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts