how to store json_encode results in a table
<p>I have a database which works by displaying first and last_names of all employees in the database, i can display it but when it displays, it's not formatted.  I want to try and put the results in a table but I'm not sure how I would.</p>

<p>I thought I would have to echo <code>json_encode(echo.&lt;td&gt;$posts&lt;/td&gt;)</code> or something like that </p>

<pre><code> &lt;?php foreach($query as $row): ?&gt;
   &lt;tr&gt; 
   &lt;td&gt;
        &lt;?php $arr = array(

                        'first_name' =&gt; $row-&gt;first_name,   
                        'last_name' =&gt; $row-&gt;last_name,

                        ); ?&gt;
    &lt;?php  $posts[] = $arr;?&gt;

    &lt;/tr&gt;
    &lt;?php endforeach; ?&gt;
    &lt;?php echo json_encode($posts);?&gt;
</code></pre>

<p>This is how its displayed now</p>

<pre><code>[{"first_name":"Georgi","last_name":"Facello"},    
{"first_name":"Georgi","last_name":"Atchley"}]
</code></pre>
