If the login fails, your SQL query should get zero rows, correct?
You are looking at the 0th (first, with zero-based arrays) element of the 0th (first) row. But that row doesn't exist. Pretending it does is a dirty thing to do, but PHP in its default configuration lets you get away with it. Which is fine, until it doesn't, and you're left scratching your head...
You have this:
if($row[0][0] !== "") {
If the SQL query returned no result, $row[0][0] does not exist, and is therefor not equal to "".
If you use "!=" PHP would try to be helpful and pretend that the null is equal to "", and you could get away with pretending that your array has a row. But this time you said "!==", which tells PHP to not try to be helpful, and to no longer pretend that a null value is magicly equal to a string of length zero (among other things).
But really you shouldn't be pretending that your array has a row when it doesn't.
The simple way to fix it is to change the "!==" to "!=". The correct way to fix it is to make the if look like this:
if (count($row) == 1) {
// user is logged in
}
else if (count($row) == 0) {
// user is not logged in
}
else {
die("Duplicate user entry in the database. This should never happen.");
}