Query Help - Where Clause

I have a forms page that will allow a user to select up to 11 criteria – the can select 1 or more up to 11. They do not have to select all 11.

I then have the following query:

mysql_select_db($database_conndb1, $conndb1);

$query_rsName = sprintf(“SELECT DISTINCT table1.search_id, table1.search1, table1.search2, table1.search3, table1.search4, table1.search5, table1.search6, table1.search7, table1.search8, table1.search9, table1.search10, table1.search11, table1.search12, table1.search13, table1.search14, table1.search15, table1.search16, table2.search_id FROM table1, table2 WHERE table2.criteria1 = %s OR table2.criteria2 = %s OR table2.criteria3 = %s OR table2.criteria4 = %s OR table2.critertia5 = %s OR table2.criteria6 = %s OR table2.criteria7 = %s OR FIND_IN_SET(%s, table2.criteria8) OR table2.criteria9 = %s OR table2.criteria10 = %s OR table2.criteria11 = %s AND table1.search_id = table2.search_id ORDER BY table1.search2 DESC”, GetSQLValueString($search1_rsName, “text”),GetSQLValueString($search2_rsName, “text”),GetSQLValueString($search3_rsName, “text”),GetSQLValueString($search4_rsName, “text”),GetSQLValueString($search5_rsName, “text”),GetSQLValueString($search6_rsName, “text”),GetSQLValueString($search7_rsName, “text”),GetSQLValueString($search8_rsName, “text”),GetSQLValueString($search9_rsName, “text”),GetSQLValueString($search10_rsName, “text”),GetSQLValueString($search11_rsName, “text”));

However, when the query is ran, it pulls all records – not just the ones based on the search criteria. Now, if I change the OR to AND and select all 11, it works as it should. Thus, it has something to do with OR operand. However, I cannot figure out what is wrong. What operand can I use besides OR that will allow this to work – to allow the searcher to select 1, 2, 3 or more criteria?

I found an answer - had to move the parenthesis around the entire where clause to include all the OR clauses in the single parenthesis.