Update MysqliDb.php

Moved piece of code so that it gets executed when it really counts.