json

  • PHP Query SQL Database return JSON Dec 27 2017
    As a Javascript developer, I always prefer to use NodeJS as my API endpoint when interacting with a backend database. Unfortunately, it’s not always feasible to use NodeJS (especially in a shared hosting environment) and you might have to fall back to good old PHP. So here’s a quick refresher on how you can perform queries to a SQL database using PHP from an Ajax or Fetch call. Fetch Call Suppose I have the following XMLhttp request using the fetch API: