Skip to content

How to insert multiple json data into mysql database in PHP?


$josndata = '{
"Customer":{ "name":"Jonny", "country":"CANADA", "ContactNo":524587777 },
"Student":{ "name":"Gussy", "country":"USA", "ContactNo":9856452100}

// Database connection
$conn = new mysqli('localhost', 'username', 'password', 'databasename');

// Insert data Query
$sql = "INSERT INTO student_table ( name, jsondata )
VALUES ('Multidata', '$josndata')";

if ($conn->query($sql) === TRUE) {
  echo "Insert your Multiple JSON record successfully";
See also  How to make a calculator in Python using object oriented programming?

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.