Jump to content
ahill

Search box that searches multiple words

Recommended Posts

What database are you using? I'm not sure about "select top 10 * mproblem", that seems like it would be an error. For the filtering issue, you're not getting the search term correctly, pay attention to what you're doing.

Share this post


Link to post
Share on other sites

its pulling from my advancedtrouble table in my test database. I had the top 10 * in yesterday by mistake when I posted. It dose not make any noticeable impact though..For the term it should be referencing my database and changing on input of a character. only thing I am confused with is they haveterm = Replace( Trim(Request("word")), "'", "''" )SQL = "select top 10 * mproblem from DBtable where mproblem like '%" & term & "%'"---------------------------------------------------------------------------------------------shouldn't it be something more likeSQL= "select mproblem from DBtable where mproblem like '% %' or mproblem like '"+ term +"'"ORSQL = " select mproblem from DBtable where mproblem like '"% & term & %"'Both of these fail if used

Edited by ahill

Share this post


Link to post
Share on other sites

and it looks like somewhere on my index page the words typed in the box should have to gather in a variable called "word" and then passed the the sql page to pull. Not quite sure how the JS works

Share this post


Link to post
Share on other sites

Wait now I was able to make it search. I changedterm = Replace( Trim(Request("word")), "'", "''" )TOterm = Replace( Trim(Request("q")), "'", "''" )Since javascript is passing the variable q from index.html to livesearch.asp.-----------------------------------------------------------------------------------My only problem is now is that I have to figure out how to get each result to display on its own line, right now they are all one line.ex.NOWresult1 result2 result3 result4What I wantresult 1result 2result 3result 4

Share this post


Link to post
Share on other sites

My only problem is now is that I have to figure out how to get each result to display on its own line, right now they are all one line.

You can send parameters to the RecordSet.getString method to tell it how to format the output, or you can loop through the recordset and format things yourself.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×