Posted inMysql / Mysqli / php

insert json data into mysql – How to Insert JSON data into MySQL using PHP?

insert json data into mysql using $obj = json_decode($json,true); MySQL INSERT statement: It is used to insert data into the database.

insert json data into mysql

Insert JSON data MySQL – There is step by step process to insert json data into Database.

 $json = file_get_contents('php://input');
 $obj = json_decode($json,true);

Read the JSON file in PHP
read the json file contents

Convert JSON String into PHP Array
convert json object to php associative array

How to Insert JSON data into MySQL using PHP?


Insert JSON Data -

query($sql) === TRUE) {
  echo "Insert your JSON record successfully";

don’t miss : How To Insert Json Data Into Mysql Using Php?

Store JSON data in MySQL Database


Store JSON Data -

$servername = "localhost";
$username = "root";
$password = "";
$dbname = "member";

// Database connection
$link = new mysqli($servername, $username, $password, $dbname);

$sql = "INSERT INTO member_table ( name, jsondata )
VALUES ('Rakesh', '$singledata')";

if ($link->query($sql) === TRUE) {
  echo "Member Insert data only single successfully";

How to Insert Multiple JSON Data into MySQL Database in Php?


Insert Multiple JSON Data -

query($sql) === TRUE) {
  echo "Insert your Multiple Member JSON record successfully";

I hope you get an idea about insert json data into mysql.
I would like to have feedback on my
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype