|
| |
|
|
jonance
Posts: 302 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
|
|
|
|
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.
_____________________________
|
|
|
|
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.
_____________________________
|
|
|
|
jonance
Posts: 302 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
|
|
|
|
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.......................
_____________________________
|
|
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
|
|
|