But when I try to test if the script were working by calling it from the browser gives me this error: HTTP Error 404.3 - Not Found
You can not access the requested page due to the configuration of the extension. If the page is a script, add a driver. If the file should be uploaded, add a MIME assignment.
You probably have to urldecode the query
As a side note : allowing direct access to the DB with a query without escaping it, is at least very dangerous