Missing space between $time and HOUR causing query to fail.