|
jonance -> RE: search across multiple fields (9/28/2003 9:35:34)
|
I think we must be close...but still get a similar error. The error is below followed by all the code from the table i am displaying the results in. I won't be home until later tonight, so i can't test till then, but i look forward to trying out what you come up with. The last thing you mentioned is EXACTLY what i'm looking for! Thanks for all your help again: Microsoft VBScript compilation error '800a0400' Expected statement /searchtest.asp, line 179 end if ^ Here is the code for that chunk of my page if it helps.... quote:
<p align="center"><font size="2" color="#800000"><b>Cart</b></font></td> </tr> </thead> <tbody> <% Dim Keyw, keyt Dim sort Dim myquery Dim myQuerystring sort = Request.form("SortColumn") 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 sort" end if myquery = Keyw response.write myquery %> <!--#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")%>"> </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> <p align="left"><font face="Arial" size="2"><strong>If you didn't find what you're looking for, </strong><strong><a href="contact.asp">send us a message</a> and we will try our best to help. </strong></font></p>
|
|
|
|