Think about your logic. If $number is 101 then it <>102, right? And if $number is 102 then it <>101, right?
Also, please do what the rest of the PHP community does: use the && || != operators instead of AND OR <>. The first group is what you see in programming languages. The second group is what you see in SQL. PHP is not SQL.