|
| |
|
|
hhammash
Posts: 1064 Joined: 8/19/2002 Status: offline
|
RE: Search using Multiple Keywords - 1/17/2003 10:44:15
Hi LLL, Thanks a lot. I tried the code, it is working fine. Also try the WHERE IN, it is different. Hisham
|
|
|
|
hhammash
Posts: 1064 Joined: 8/19/2002 Status: offline
|
RE: Search using Multiple Keywords - 1/17/2003 13:54:35
Hi Mark, It is the IN code, the second one. Hisham
|
|
|
|
hhammash
Posts: 1064 Joined: 8/19/2002 Status: offline
|
RE: Search using Multiple Keywords - 1/17/2003 13:57:19
Hi Mark, This is the code. quote:
<%DIM myArray, myQuerystring myArray = split(Request.Form(" keywords" )," " ) ' splitting on spaces myQuerystring = " " FOR i = 0 to (uBound(myArray)-1) myQuerystring = myQuerystring & " ' " & myArray(i) & " ' ," NEXT ' don' t want a comma trailing the last one myQuerystring = myQuerystring & " ' " & myArray(ubound(myArray)) & " ' " %> Hisham
|
|
|
|
hhammash
Posts: 1064 Joined: 8/19/2002 Status: offline
|
RE: Search using Multiple Keywords - 1/17/2003 13:58:37
Hi again, The SQL statement would be: quote:
Then for your dieted DRW query, maybe something like: fp_sQry=" SELECT * FROM myTable WHERE keyword IN (" & myQuerystring & " )" CU Hisham
|
|
|
|
hhammash
Posts: 1064 Joined: 8/19/2002 Status: offline
|
RE: Search using Multiple Keywords - 1/17/2003 14:00:25
Hi Mark, Remember, it worked for me when I created two separate pages not the same one. Page 1: Will have the search form and post it to the DRW page Page 2: Will have the DRW with the code above Put the DRW on diet then change the sql statement. Regards Hisham
|
|
|
|
hhammash
Posts: 1064 Joined: 8/19/2002 Status: offline
|
RE: Search using Multiple Keywords - 1/19/2003 9:23:42
Hi again, Can you investigate why it is not working in one page? it is strange. I know when you dig for something you will find, no matter how deep it is. Thanks Hisham
|
|
|
|
hhammash
Posts: 1064 Joined: 8/19/2002 Status: offline
|
RE: Search using Multiple Keywords - 1/20/2003 16:11:28
Hi Mark, I got this from the new member Tarwn, he is in another forum too. He explained why it did not work on one page and gave the solution. Please read it and let me know what you think: quote:
Tarwn Ok, in this instance you would have to skip the code the first time the page loaded, then set the form to submit back to this same page. On the second pass you could then use the code. The reason behind this is because the ASP is going to execute before the page is ever sent to the user, so by the time the user actually has the form in fron of them and is starting to fill it out, the ASP script is already exiting and gone. This is why you wre egtting an array index out of bounds, because the ASP code was attempting to run before the user even had a chance to fill out the form. Since there was nothing in the form collection yet you were dealing with an empty array. You would probably be better of doing this in seperate pages, or if you want it in one page then do something like this: If Request.Form(" Country" ) <> " " Then ' do your submission code here Else ' display your html form and usch here End If This way if there is nothing in the form collection it displays the form, then set the action of the form to this address. If there is something in the form collection it means the page already loaded once and the user has fillerd out the information, so go to thwe submission code and submit it to the db. Hope this helps, -Tarwn Thanks Hisham
|
|
|
|
Long Island Lune
Posts: 2340 Joined: 6/8/2002 From: New York Status: offline
|
RE: Search using Multiple Keywords - 1/20/2003 23:08:10
Hisham, This problem reminds me of the old DOS to Windows software changeover of 1985. Programmers then were use to controling software and interaction the DOS way. You could stop software processing and have the program wait until a user interacted with the program in some way. Windows 3.0 of 1985 changed all that. Now halting program execution was not possible the old traditional way due to real-time messaging between objects and windows. When it comes to doing everything on one-page in Internet devleopment, you need to be able to execute portions of code and have other portions of code stay in a suspened state until the user has interacted with the page in some way. Tarwn' email offered one way of doing this. It makes sense. He saved me writing a long story and condensed it good. I was thinking along this line myself but wanted to play with it first. I would try it.
_____________________________
|
|
|
|
hhammash
Posts: 1064 Joined: 8/19/2002 Status: offline
|
RE: Search using Multiple Keywords - 1/21/2003 0:24:14
Hi Mark, quote:
If Request.Form(" Country" ) <> " " Then ' do your submission code here Else ' display your html form and usch here End If In our case we don' t need submission code, I think we have to replace the ' do your submission code here wit the SQL statement. Try it when you have time, I will to then we can share the results. Thanks Mark Hisham
|
|
|
|
Long Island Lune
Posts: 2340 Joined: 6/8/2002 From: New York Status: offline
|
RE: Search using Multiple Keywords - 1/21/2003 13:59:46
Hisham, Exactly... The SQL assembler should go there.
_____________________________
|
|
|
|
hhammash
Posts: 1064 Joined: 8/19/2002 Status: offline
|
RE: Search using Multiple Keywords - 1/21/2003 15:35:02
Thanks Mark, CU
|
|
|
|
hhammash
Posts: 1064 Joined: 8/19/2002 Status: offline
|
RE: Search using Multiple Keywords - 1/22/2003 12:44:54
Hi Linda, Got the message already, don' t worry? Hisham
|
|
|
|
Long Island Lune
Posts: 2340 Joined: 6/8/2002 From: New York Status: offline
|
RE: Search using Multiple Keywords - 1/27/2003 23:32:21
LB, Message received.
_____________________________
|
|
|
|
Long Island Lune
Posts: 2340 Joined: 6/8/2002 From: New York Status: offline
|
RE: Search using Multiple Keywords - 2/6/2003 23:40:52
Hisham, I spent some time playing with code from the site address you gave me a long time ago. http://www.fmhs.uaeu.ac.ae/immconf/country2.asp I think spooky hit the nail on the head with wildcards. Nice piece of code though. Great if you know exact matches are what you need.
_____________________________
|
|
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
|
|
|