Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

T-Cubed Advanced Search

Posted 11 May 2001 23:14:28
1
has voted
11 May 2001 23:14:28 Kelly Brady posted:
I am using the t3-advanced search and I wanted to try and modify the search. I am trying to add a drop down menu that contains categories in it. I wanted the advance search not only to look at all the words a user types in but also provide them the capabilities of only searching in a particular category according to what they have selected. Any help would help.


My category table is of data type INT Name: CATEGORY_ID

Again how would I modify the script to also use the pull-down to query records in addition to what the T-Cubed Advanced Search allready does



Replies

Replied 14 May 2001 11:54:12
14 May 2001 11:54:12 Waldo Smeets replied:
I don't know what the script looks like now. But you have to take the WHERE statement from the sql script and also put the statement WHERE CATEGORY_ID=2 or something like that.

Waldo Smeets - www.UDzone.com Webmaster
------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
------------------------------------------
Replied 14 May 2001 16:44:41
14 May 2001 16:44:41 Kelly Brady replied:
I have tried that but being that there is an array that has been created for the ALL WORDS, ANY WORDS, EXACT PHRASE pulldown I can't seem to write this into the statement. Here is the code:

<%@ LANGUAGE = "VBScript"
ENABLESESSIONSTATE = False %>
<%
Response.CacheControl = "Public"
%>
<!--#include file="Connections/garlock.asp" -->
<%
Dim CompType, t3_advSearch_String
'Store type of query in CompType ie All Words/OR, Any Word/AND or Exact Phrase/EXACT
CompType = Request("CompType"
SearchColumn = "FAQ_KEYWORDS"
'faq_category_id = Request.Form("FAQ_CATEGORY_ID"

SearchField = "zzz"
if(Request("SearchParam" <> "" then SearchField = Request("SearchParam"
'Remove any single quotes from search field to eliminate potential errors.
SearchField = Replace(SearchField, "'", ""

'Checks the CompType, Executes this code if the option All words or Any Word is chosen
if(CompType <> "EXACT" then
t3_advSearch_String = "WHERE " & SearchColumn & " LIKE '%"
'Splits the search criteria into seperate words and stores them in an Array
SearchArray=Split(SearchField," "
for i = 0 to Ubound(SearchArray)
if i > 0 then
'Builds the sql statement using the CompType to substitute AND/OR
t3_advSearch_String = t3_advSearch_String & " " & CompType & " " & SearchColumn & " LIKE '%"& SearchArray(i) & "%'"
else
'Ends the sql statement if there is only one word
t3_advSearch_String = t3_advSearch_String & SearchArray(i) & "%'"
end if
next

else
t3_advSearch_String = "WHERE " & SearchColumn & " LIKE '%" & SearchField & "%'"
end if
%>
<%
Dim rsSearch__t3_String
'rsSearch__t3_String = "WHERE ID=1"
if (t3_advSearch_String <> "" then rsSearch__t3_String = t3_advSearch_String
%>
<%
set rsSearch = Server.CreateObject("ADODB.Recordset"
rsSearch.ActiveConnection = MM_garlock_STRING
rsSearch.Source = "SELECT * FROM dbo.FAQ " + Replace(rsSearch__t3_String, "'", "'" + ""
rsSearch.CursorType = 0
rsSearch.CursorLocation = 2
rsSearch.LockType = 3
rsSearch.Open()
rsSearch_numRows = 0
%>

I need to somewhere put in the WHERE FAQ_CATEGORY_ID = "" AND the above t3 script

I have even tried this:

Dim category_id
category_id = Request.Form("FAQ_CATEGORY_ID"


"SELECT * FROM dbo.FAQ WHERE FAQ.FAQ_CATEGORY_ID =" & category_id & + Replace(rsSearch__t3_String, "'", "'" + ""

I have also made changes to the array script by taking out the where and replasing it with an AND

Waldo Smeets - www.UDzone.com Webmaster
------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
------------------------------------------


Reply to this topic