I\'m currently working on a solution in php which queries an sql database. However, i want other website to be able to query the database (or the functions in php). I search
Sounds to me like you're inadvertently writing a web API. REST is hot these days, for good reason (they play well with javascript clients, for one).
Here is a thread that should give you lots to chew on.