JsonMysqlPhp

How to change MySQL data in JSON format?

change MySQL data in JSON format

Views

Hello to all, welcome to therichpost.com. In this post, I will tell you How to change MySQL data in JSON format? When we want to send data one page to other page then we can use json formatted data. We will save Mysql data in json format.
We can this json formatted data jquery ajax request get or post.

Please check the working example of change MySQL data in JSON format:

$con=mysqli_connect($servername,$username,$password,$databasename);
if (mysqli_connect_errno())
{
echo “Connection Error” . mysqli_connect_error();
}
$query = “SELECT * FROM TableName”;
$result = mysqli_query($con,$query);
$querydata = array();
while($data = mysqli_fetch_array($result)) {
$querydata[] = $data;
}
echo json_encode($querydata);
mysqli_close($con);

There are so many queries in Mysql and I will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com

Ajay Malhotra
the authorAjay Malhotra
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am full stack developer. I love coding. I know Wordpress, Core php, Angularjs, Angular 2, Angular 6, Angular 7, laravel, Codeigniter, Shopify, Squarespace, Jquery, Google Map Api, Vuejs, Reactjs, Bigcommerce etc.

Leave a Reply

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

Positive SSL