Greetings,
I have a search page with three search boxes: city, state, country. I'm in a quandry because I don't know how to write the sql query, or do I need multiple queries, because the user does not necessarily have to fill in all three search boxes. Here's what I have:
sql = "select * from tbl_class_data where (Class_Name LIKE N'%" & city & "%' OR Meeting_Church_City LIKE N'%" & city & "%') OR (meeting_church_state='" & state & "') OR (country='" & country & "') AND class_type=1 ORDER BY Meeting_Church_City"
This works great if all three boxes are filled in, but craps out if they leave one or two blank, doesn't return anything. How do I handle this? I've tried to find the answer in the posts but to no avail. Thanks in advance.
I have a search page with three search boxes: city, state, country. I'm in a quandry because I don't know how to write the sql query, or do I need multiple queries, because the user does not necessarily have to fill in all three search boxes. Here's what I have:
sql = "select * from tbl_class_data where (Class_Name LIKE N'%" & city & "%' OR Meeting_Church_City LIKE N'%" & city & "%') OR (meeting_church_state='" & state & "') OR (country='" & country & "') AND class_type=1 ORDER BY Meeting_Church_City"
This works great if all three boxes are filled in, but craps out if they leave one or two blank, doesn't return anything. How do I handle this? I've tried to find the answer in the posts but to no avail. Thanks in advance.