You're getting this error because $query isn't defined when mysql_num_rows($query) is called. $query should be whatever mysql_query() returned. That's the invalid resource reason.
Anyway, you sql statement is probably not being executed because the variables inside aren't quoted. If $C_name has "John" on its value, PHP parses $C_name and your last line will be this: c_name = John
Now Mysql thinks that John is a column from a table. Or this part (your actual 1st post):
priority in (A, , )
You see, (A, , ) is wrong. It should be ('A', '', ''), these are empty values.
Anyway, just put single-quotes around your variables, it should work :p