Skip to content
Advertisement

How do I output in proper JSON format in PHP?

I want to output some records from mysql table with resCode and resText in JSON in the following way:

JavaScript

Since I’m very new to PHP arrays, I’m unable to format the server side part to output like above. Also I don’t know how to output the resCode and resText.

Any help for the same will be appreciated.

PHP part:

JavaScript

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement