Today I'm going to share this code I used to generate a JSON string with data from MySQL database.
For those not yet familiar, JSON is a lightweight data interchange format (like XML but it is lightweight).
It has been used by companies like Google and Facebook in their APIs.
Recently, I needed a JSON string to get data from the web to the Android app I'm working on.
The PHP file gets a parameter company_id to select few data related to a company.
Please note that this is not a production ready code, but is very useful to get you started and can serve as quick reference.