How can I prevent a user from selecting exactly one of two (not both or none) categories on a post?

How can I prevent a user from selecting exactly one of two (not both or none) categories on a post?

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)