hoosierdoc
Technical User
- Oct 17, 2006
- 3
I have struggled with this all day but finally figured it out. I couldn't find anywhere online where this was discussed so here's my code. It lets you put in unlimited keywords and then do a sql search based on the category and keywords you want. Currently it's an 'OR', but could easily make it in 'AN'. It's ugly code to be sure, but it works. I'm not a programmer, so no crappy comments.
------
cat = request.form("cat")
keyworda = request.form("keyword")
cat = Cstr(cat)
keyworda = Cstr(keyworda)
key = split(keyworda, " ", -1, 1)
For i = 0 to Ubound(key)
blah = blah & "'%" & key(i) & "%' OR " & cat & " Like "
next
xx = len(blah)
blah2 = left(blah, xx-18)
sql = "select * from cat where " & cat & " Like " & blah2
------
cat = request.form("cat")
keyworda = request.form("keyword")
cat = Cstr(cat)
keyworda = Cstr(keyworda)
key = split(keyworda, " ", -1, 1)
For i = 0 to Ubound(key)
blah = blah & "'%" & key(i) & "%' OR " & cat & " Like "
next
xx = len(blah)
blah2 = left(blah, xx-18)
sql = "select * from cat where " & cat & " Like " & blah2