I'm currently lost on how to do this and need help but I'm currently building an ionic app and storing information on a database when fetching that information back through the PHP script I'm recieving JSON which I would like to convert to a nice formatted HTML table
Here is my PHP
<?php
header("Access-Control-Allow-Headers: Content-Type");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
header("Access-Control-Allow-Origin: *");
$host = "****";
$user = "*****";
$password = "";
$database = "holes";
$connect = mysqli_connect($host,$user,$password,$database) or die("Problem connecting.");
$result = mysqli_query($connect, "SELECT * from hole18") or die("Bad Query.");
mysqli_close($connect);
$results = array();
while($row = mysqli_fetch_assoc($result))
{
$results[] = $row;
}
echo json_encode($results);
?>
And here's the Json output:
[{"index":"1","Par":"4","FIR":"1","GIR":"1","Score":"3","puttsno":"1","bunkershit":"0","oob":"0"}]
Please help me
$json = file_get_contents('url_here'); $obj = json_decode($json); echo $obj->index;whereurl_herewill be the path of the php file you wrote.