How to Convert Data from MySQL to JSON using PHP
In PHP, Converting Data from MySQL to JSON Format is one of the prominent tasks in Web Development . JSON has gained popularity over the years and is preferred over xml as data exchange format between web applications. Using json format has its own advantages like being light weight, ability to store complex data structures in plain text and very human readable. Earlier we have discussed about converting json to mysql data here. Now let us see how to convert mysql result set to json in php. Create MySQL Database Here is the MySQL Database I'm going to use as an example. Run these sql commands to create the Database. Read Also: How to Export MySQL Database to CSV File using PHP Build Simple Search Engine using AJAX, PHP & MySQL Login and Registration Script using PHP, MySQL & jQuery CREATE TABLE IF NOT EXISTS `tbl_employee` ( `employee_id` int(4) NOT NULL AUTO_INCREMENT, `employee_name` varchar(60) NOT NULL, `designation` varchar(30) NOT NULL, `hired...