Fixed POST request handling.
Fixed SQL query syntax error