%
' Zinaida... This page replaces "search.htm" in the wildflowers folder.
'
' The results are returned on the same page. You will have to change the links in your
' flash file to move to these asp pages (search.asp, color.asp, latin_name.asp, family_name.asp
' common_name.asp)
Option Explicit
Dim objConnection
Dim sConnStr
Dim objRS
Dim vSelect
Dim sSearchCriteria
%>
California Wildflowers - Search
<%
If Request.Form("submit") = "Search" Then
' connect to database
MakeDBConnection objConnection, objRS, "WildflowersWeb"
' build search query
vSelect = "SELECT * FROM vWFSpecies WHERE "
If Request.Form("color") <> "" Then
vSelect = vSelect & "color LIKE '%" & Request.Form("color") & "%' AND "
sSearchCriteria = "Color = " & request.form("color") & " AND "
end if
If Request.Form("petals") <> "" Then
if request.form("petals")="many" then
vSelect = vSelect & "(petal_number LIKE '%" & Request.Form("petals") & "%' OR petal_min > 6) AND "
else
vSelect = vSelect & " (" & request.form("petals") & " BETWEEN petal_min and petal_max OR " & request.form("petals") & "= petal_min) AND "
end if
sSearchCriteria = sSearchCriteria & " Petals = " & request.form("petals") & " AND "
end if
If Request.Form("family_name") <> "" Then
vSelect = vSelect & "family_name LIKE '%" & Request.Form("family_name") & "%' AND "
sSearchCriteria = sSearchCriteria & "Family contains '" & request.form("family_name") & "' AND "
end if
If Request.Form("latin_name") <> "" Then
vSelect = vSelect & "latin_name_txt LIKE '%" & Request.Form("latin_name") & "%' AND "
sSearchCriteria = sSearchCriteria & "Latin Name contains '" & request.form("latin_name") & "' AND "
end if
If Request.Form("common_name") <> "" Then
vSelect = vSelect & "common_name LIKE '%" & Request.Form("common_name") & "%' AND "
sSearchCriteria = sSearchCriteria & "Common Name contains '" & request.form("common_name") & "'"
end if
vSelect = vSelect & " image_type = 'thumb' ORDER BY common_name ASC "
objRS.Open vSelect, objConnection
' display results
if right(trim(sSearchCriteria),3) = "AND" then
sSearchCriteria = left(sSearchCriteria,len(trim(sSearchCriteria))-3)
end if
'response.write(objRS.RecordCount)
response.write(" Flowers where " & sSearchCriteria & " ")
Response.Write("")
Call LogHits("Wildflowers",vSelect,objRS.RecordCount)
objRS.Close
objConnection.Close
Set objConnection = Nothing
Set objRS = Nothing
Else
' show search form
%>
<%
End If
%>
|
| |
|