Answers for "how to insert multiple json data into mysql database in php"

PHP
0

how to insert multiple json data into mysql database in php

<?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";
} 
?>
Posted by: Guest on July-06-2020

Code answers related to "how to insert multiple json data into mysql database in php"

Browse Popular Code Answers by Language