• logo
  • PHP
  • PHP OOPs
  • script
    • JavaScript
    • JQuery
    • Ajax
    • AngularJs
    • VueJs
    • NodeJs
    • ReactJs
  • wordpress
  • Codeigniter
  • Codeigniter 4
  • Laravel
  • Python
  • MySql
  • Json
  • C
  • C++
  • More ...
    • Cakephp Framework
    • MongoDb
    • MySqli PDO
    • .htaccess
    • HTML 5
    • CSS
    • SEO
    • DCA

JSON Tutorials

  • What is Json
  • Json Example
  • Json Object Example
  • Json with php
  • How to Convert Data from MySQL to JSON using PHP
  • How to store json Data into MySQL database using PHP
  • How to insert json data into mysql database using PHP
  • validate json string in php
  • Json with AJAX
  • Json with javascript
  • Json Program example

 Important Links

Read More

Home » JSON »  Mysql with Json using php

How to Convert Data from MySQL to JSON using PHP

http://www.kodingmadesimple.com/2015/01/convert-mysql-to-json-using-php.html


Create MySQL Database

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_date` date NOT NULL, `salary` int(10) NOT NULL, PRIMARY KEY (`employee_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; INSERT INTO `tbl_employee` (`employee_id`, `employee_name`, `designation`, `hired_date`, `salary`) VALUES (1, 'Steve', 'VP', '2013-08-01', 60000), (2, 'Robert', 'Executive', '2014-10-09', 20000), (3, 'Luci', 'Manager', '2013-08-20', 40000), (4, 'Joe', 'Executive', '2013-06-01', 25000), (5, 'Julia', 'Trainee', '2014-10-01', 10000);

File name : index.php