You should use
SQL_FastQuery instead of a
SQL_Query.
To address your issue, adapt the snippet
here to your code, in order to print an error if your query fails. You can also try to access your database's log (if you can) to see where an error might happen.
__________________