weee
11-18-2004, 12:30 PM
Hi There.
I built a serch engine but it seems like it doesn't work good:
It contains 3 different type of search. The problem accur whenever I choose everything else but the first one (visa). Then I'm getting n error. I think it's something in the IF's I wrote. Any idea how should I do it better?
visa = fixStr(request.form("visa"))
continent = fixStr(request.form("continent"))
gender = fixStr(request.form("gender"))
If visa <> "" Then
SQLvisa = " WHERE visa='" & visa & "'"
Else
SQLvisa = ""
End If
If continent <> "" Then
SQLcontinent = " AND continent='" & continent & "'"
If visa = "" Then
SQLcontinent = " WHERE continent='" & continent & "'"
End If
Else
SQLContinent = ""
End If
If gender <> "" Then
SQLgender= " AND gender='" & gender & "'"
If continent = "" Then
SQLgender = " WHERE gender='" & gender & "'"
End If
Else
SQLgender= ""
End If
SQL = "SELECT FirstName,LastName,email,PhoneNumber1,PhoneNumber2 FROM members" & SQLUSVisa & SQLgender & SQLContinent & " ORDER BY id"
Thanks!
I built a serch engine but it seems like it doesn't work good:
It contains 3 different type of search. The problem accur whenever I choose everything else but the first one (visa). Then I'm getting n error. I think it's something in the IF's I wrote. Any idea how should I do it better?
visa = fixStr(request.form("visa"))
continent = fixStr(request.form("continent"))
gender = fixStr(request.form("gender"))
If visa <> "" Then
SQLvisa = " WHERE visa='" & visa & "'"
Else
SQLvisa = ""
End If
If continent <> "" Then
SQLcontinent = " AND continent='" & continent & "'"
If visa = "" Then
SQLcontinent = " WHERE continent='" & continent & "'"
End If
Else
SQLContinent = ""
End If
If gender <> "" Then
SQLgender= " AND gender='" & gender & "'"
If continent = "" Then
SQLgender = " WHERE gender='" & gender & "'"
End If
Else
SQLgender= ""
End If
SQL = "SELECT FirstName,LastName,email,PhoneNumber1,PhoneNumber2 FROM members" & SQLUSVisa & SQLgender & SQLContinent & " ORDER BY id"
Thanks!