Made it work, added query string support & database var escaping