So i had setup a site which fetches mysql queries and get output json from PHP which then i put to use with js.
So it becomes a 5 step process.
Query -> PDO Statement -> PHP Array -> JSON Strings -> JS Object or AJAX
Step 3-4-5 can be controversial as per developers choice.
I use JSON for mostly lower informative textual content which actually doesn't get valued among security concerns. But to manage a large textual content over ( > 100000) queries, its better to stick with mysql. Mysql is very native to PHP. So why shouldn't we just use php to perform same tasks that we make use for json.
I understand a major block would be ajax calling, but with advent of reactphp web server scripts, async calls can be made [link].
If we can work out in 3 steps using PHP, then is there any absolute reason we should use/recommend
JSON?Speed, flexibility, offline-nature?Anything else?
Edit:
How can i reduce the steps to output my mysql query as JSON omitting php json_encode
function? CAn it be done directly?