This simple web-serivce provides REST API for SQL query building.
For more information please read this article which describes how to use EasyQuery widgets and this web-service with PHP backend.
To start using the service you need an API key which you will get by email after registration.
Oh. Forgot to mention: it's all FREE at the moment!