|
jonance -> RE: search across multiple fields (9/28/2003 22:27:16)
|
Oh...i had restructured the page for cleanliness' sake and forgot to put that back in. NOW we have a new prob....the page seems to work, but it isn't really returning results right for some reason. For instance...just search the letter 'a'...only one item comes up...even though there are many more with the letter 'a'...as there are 1000's in the db. Even still..when you see that sipa sipa footbag result.....type in 'footbag'...it returns no results...here my current code. It just isn't searching quite right for some reason...if you type in "black label" you should see all the products you saw when i accidentally had the normal search in there...about 200 items. You only get 1 item...again, we are very close i think... quote:
<% Dim Keyw, keyt Dim sort Dim myquery Dim myQuerystring Keyt = " SELECT * FROM products WHERE " Keyw = split(Request.Form("search" )," " ) myQuerystring = "(Itemname Like ' %" & trim(Keyw(0)) & " %' )" myQuerystring = myQuerystring & " OR (brands Like ' %" & trim(Keyw(0)) & " %' )" myQuerystring = myQuerystring & " OR (category Like ' %" & trim(Keyw(0)) & " %' )" myQuerystring = myQuerystring & " OR (subcategory Like ' %" & trim(Keyw(0)) & " %' )" if uBound(Keyw) > 1 Then for i = 1 to uBound(Keyw) myQuerystring = myQuerystring & " OR (Itemname Like ' %" & trim(Keyw(i)) & " %' )" myQuerystring = myQuerystring & " OR (brands Like ' %" & trim(Keyw(i)) & " %' )" myQuerystring = myQuerystring & " OR (category Like ' %" & trim(Keyw(i)) & " %' )" myQuerystring = myQuerystring & " OR (subcategory Like ' %" & trim(Keyw(i)) & " %' )" next end if Keyw = Keyt + myQuerystring Keyw = Keyw + "ORDER BY ::SortColumn:: " myquery = Keyw %> <!--#include file="_fpclass/fpdblib.inc"--> <% fp_sQry=myquery fp_sDefault="search=&search=&search=&search=&SortColumn=brands" fp_sNoRecords="<tr><td colspan=12 align=left width=""100%"">No products matched your search criteria...</td></tr>" fp_sDataConn="louisvilleguide" fp_iMaxRecords=0 fp_iCommandType=1 fp_iPageSize=20 fp_fTableFormat=True fp_fMenuFormat=False fp_sMenuChoice="itemname" fp_sMenuValue="itemname" fp_iDisplayCols=12 fp_fCustomQuery=True BOTID=0 fp_iRegion=BOTID %> <!--#include file="_fpclass/fpdbrgn1.inc"--> <tr> <td bgcolor="#FFFFE6" width="85"> <p align="center"><a href="productdetail.asp?ID=<%=FP_FieldURL(fp_rs,"ID")%>"><img border="0" src="pics/<%=FP_FieldLink(fp_rs,"picture")%>" height="72"></a></p> </td> <td bgcolor="#FFFFE6"> <p align="center"><font size="2" color="#00004F"> <%=FP_FieldVal(fp_rs,"brands")%> </font> </td> <td bgcolor="#FFFFE6"> <p align="center"><a href="productdetail.asp?ID=<%=FP_FieldURL(fp_rs,"ID")%>"> <%=FP_FieldVal(fp_rs,"itemname")%></a> <%If FP_FieldVal(fp_rs,"activated") = "no" then%> <img border="0" src="images/outofstock.jpg"><%Else%> <%End If%> <%If FP_FieldVal(fp_rs,"activated") = "preorder" then%> <img border="0" src="images/preorder.jpg"><%Else%> <%End If%> </p> </td> <td bgcolor="#FFFFE6"> <p align="center"><font size="2" color="#00004F"> <%=FP_FieldVal(fp_rs,"category")%></font></td> <td bgcolor="#FFFFE6" width="70"> <p align="center"><font size="2" color="#00004F"><%=FormatCurrency(FP_FieldVal(fp_rs,"price"))%></font></td> <td bgcolor="#FFFFE6" width="64"> <p align="center"><a href="http://ww6.aitsafe.com/cf/add.cfm?product=Item+Number+<%=FP_FieldURL(fp_rs,"itemnumber")%>+--+<%=FP_FieldURL(fp_rs,"brands")%>+--+<%=FP_FieldURL(fp_rs,"itemname")%>&price=<%=FP_FieldURL(fp_rs,"price")%>&qty=1&userid=83100920&units=<%=FP_FieldURL(fp_rs,"weight")%>"><img border="0" src="images/addtocart.jpg"></a></td> </tr> <!--#include file="_fpclass/fpdbrgn2.inc"--> </tbody> </table> <p align="center"> </p>
|
|
|
|