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. Php Mysql Edit Delete Update File' title='Php Mysql Edit Delete Update File' />Convert MySQL to JSON using PHP. Learn how to convert the mysql query result set to json format or file with PHP Programming Language. Easily export mysql to json. In this article we have explained you step by step insert, update, select and delete using asp. This article is useful for beginners who want. Checks to be made if you have a problem after installing Wampserver. Most of these checks can be done before installing WampServer. Note Do not reply to this message. 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. Php Mysql Edit Delete Update File' title='Php Mysql Edit Delete Update File' />Create My. SQL Database. Here is the My. SQL Database Im going to use as an example. Run these sql commands to create the Database. Read Also. CREATE TABLE IF NOT EXISTS tblemployee. NOT NULL AUTOINCREMENT. NOT NULL. designation varchar3. NOT NULL. hireddate date NOT NULL. NOT NULL. PRIMARY KEY employeeid. ENGINEMy. ISAM DEFAULT CHARSETlatin. AUTOINCREMENT1. INSERT INTO tblemployee employeeid, employeename, designation, hireddate, salary VALUES. Steve, VP, 2. Robert, Executive, 2. Luci, Manager, 2. Joe, Executive, 2. Julia, Trainee, 2. Convert My. SQL to JSON String in PHPHere are the steps in converting mysql to json string with php. Step 1 Open My. SQL Database Connection in PHPFirst establish connection to mysql database using mysqliconnect function. Install Wget Mac Os X Mac Ports Vs Homebrew. Error. mysqlierrorconnection. Step 2 Fetch Data from My. SQL Database. After opening the connection, fetch the required table data from mysql db. Using the php function mysqliquery, Im going to fetch all the rows from the table tblemployee. Want to edit wpconfig. WordPress settings Learn how to comfortably edit wpconfig. WordPress. Error in Selecting. Step 3 Convert My. SQL Result Set to PHP Array. Next loop through the mysql result set we got from step 2 and convert it to php array. Step 4 Convert PHP Array to JSON String. Next use the PHP function jsonencode to convert the php array to json string. Learn about using php jsondecode function here. Thats it We have successfully converted mysql to json using php. Here is the complete PHP code for it. Error. mysqlierrorconnection. Error in Selecting. Run the code and you get an output something like this. Convert My. SQL to JSON File in PHPIf you want to write the data from mysql to json file, use this piece of code at the end instead of echo statement. Read Also Find this PHP My. SQL to JSON conversion tutorial useful Like us on Facebook and never miss any of our tutorials.