Monday, May 20, 2024

How to change MySQL data in JSON format?

change MySQL data in JSON format

Hello to all, welcome to 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:

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);

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.

the authortherichpost
Hello to all. Welcome to Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 14, Angular 15, Angular 16, Angular 17, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

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