Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sirmanix
Starting Member
9 Posts |
Posted - 2001-09-19 : 08:54:50
|
| hi,I have the following code to make an AND query for as many words a user enters in a Form. If I enter one word it works fine. with 2 or more than 2 words it doesnt work properly and always ignores the 2nd word the user has entered in the form.What did I do wrong?thanks for the help Words=request.form("search")Words = split(Input, " ")count=Ubound(Words)'-- if user just entered one word do this--if count=0 thenquery="'%" &Words(i)& "%'"else'-- if user entered more than 1 word --for i=0 to count'-- while end of array make query with ANDif i<count thenquery=query & "'%" &Words(i)& "%'"&" AND "else'----end of array so don't add AND at ending.query=query & "'%" &Words(i)& "%'" end ifi=i+1nextend if'-- now make sql query ----SQL="SELECT * FROM [Artikle] WHERE ([text] LIKE "& search &") ORDER BY time" |
|
|
|
|
|