how to get data from string with JSON object in php

First create connectivity to your database

afterwards follow the code instruction and hints

<?php

$connect=mysqli_connect(“localhost”,”root”,”root”,”sales”);

$query = mysqli_query($connect,”Select * from user_info”);
// now i am creating a temporary variable array
$temporary = array();
// Gets table details
$result = $query;
// Adds each records/row to $temporary
while($row=mysqli_fetch_row($result)) {
    $temp[] = $row;
}
// now it would print in json format
echo json_encode($temporary);
?>