First of all, "$POST['mid']" is a text input, and as such will be a string scalar, not an array; your script won't get past the first line. Even if by a miracle it did, "count(POST['mid'])" will be 1, and your loop will execute only once. But that's probably not completely a bad thing, since you have your query inside the loop. It would be called every time through.
You have "if (($POST['B']) < ($row3[1]))". I'm not sure, but I don't think the size of a non-existent array relates to anything here--"$POST['B']", like "$_POST['mid']", isn't itself an array. And "$count_check = sizeof($i)": that also will always return 1, because it's the element count of a scalar...which is in turn the element count of a scalar. As for "if ($count_check > 0)", well, of course it's going to always be true.
I don't know what you expect your query to return, what "$row101" is, or what kind of data you expect to be posted, or I'd write a little code to get you started. So my advice is to start over. 🙂