Whenever you are going to check one logic means, check twice if we are using correct operators.
Most of them doing the same mistake like ,
if ($count = 0) // here you are assigning the value to $count variable
Assign the values instead of compare the values.
if ($count == 0) // here variable is compared
We can use more operators for comparing the logical condition.Such like ( >, <, >=, <=, == )