On that line:

while(($row = $stmt->fetch()) != false) {

the "!= false" is redundant.
It would make a difference when it was not identical "!=="

So you could write it like this, and it will make no difference at all:

while($row = $stmt->fetch()) {

It's easier to read.