Perhaps I'm just very dense today, but I don't see the difference or the problem >.<
You fetch the array and assigned it to a variable and then you tried to count the rows of that variable...you should be using the query handle to do it. i.e. remove the bit in red...
(Look at your code, you've used fetch_array() twice. )