title: Displaying data from JSON file in table using PHP
body: <p>Please can someone point out where I'm going wrong.</p>
  
  <p>I'm trying to display JSON data file (produced from the export function in phpmyadmin) in a html table using PHP.</p>
  
  <p>Here is the JSON file:</p>
  
  <pre><code>      /**
         Export to JSON plugin for PHPMyAdmin
         @version 0.1
         */
  
        [{"Player": "Shazu","Games Without Loss": 8}, {"Player": "Vlad","Games Without Loss": 7}]
  </code></pre>
  
  <p>Here is the PHP:</p>
  
  <pre><code>      &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"                               "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
        &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
        &lt;link href="CSS/json.css" rel="stylesheet" type="text/css" /&gt;
  
        &lt;head&gt;
        &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
        &lt;title&gt;Untitled Document&lt;/title&gt;
        &lt;/head&gt;
  
        &lt;body&gt;
  
        &lt;thead&gt;
  
            &lt;tr&gt;
                &lt;th&gt;Player&lt;/th&gt;
                &lt;th&gt;Games Without Loss&lt;/th&gt;
            &lt;/tr&gt;
        &lt;/thead&gt;
  
        &lt;?php
  
        $json=file_get_contents("1314withoutloss.json");
        $data =  json_decode($json, true);
  
  
        foreach($data-&gt;results as $item) 
        {
                echo '&lt;tr&gt;';
                    echo '&lt;td&gt;'.$item['Player'].'&lt;/td&gt;';
                    echo '&lt;td&gt;'.$item['Games Without Loss'].'&lt;/td&gt;';
                echo '&lt;/tr&gt;';
        }
  
        ?&gt;
  
        &lt;/body&gt;
        &lt;/html&gt;
  </code></pre>
  
  <p>This is what I get in the browser:</p>
  
  <blockquote>
    <p>Player Games Without Loss<br>
    Notice: Trying to get property of non-object in   C:\xampp\htdocs\Playersleague2\jsontest.php on line 32  </p>
    
    <p>Warning: Invalid argument supplied for foreach() in   C:\xampp\htdocs\Playersleague2\jsontest.php on line 32  </p>
  </blockquote>
  
  <p>Your help would be much appreciated.</p>