Fixed issues report by scrutinizer

Wasn't actually sure what to do about the debug check and printing sql query as now we are on dbFacile this isn't so obvious. We could compile the query first before passing to dbFacile but this would mean potentially three separate values, 1 variable and 2 arrays.

For now I've removed the two that scrutinizer have reported back on.

This also fixes some sloppy finger work :/