Q:

PHP Display HTML retrieved from database

I'm retrieving some html source code that is stored in a database and storing that in a PHP variable.  The html source code is the rows for a table and might look like this:
<tr><td>10:00 AM</td><td class="success">Available</td></tr> 
<tr><td>10:15 AM</td><td class="success">Available</td></tr> 
<tr><td>10:30 AM</td><td class="success">Available</td></tr> 

I'm storing this in a variable $tableRows. 
In my PHP page I have some of the table code in the page and I'm attempting to include the table rows like this:
<table class="table table-condensed table-hover table-bordered">

<tr>
<th scope="col">Time</th>
<th scope="col"><?php  echo $date ; ? ></th>
</tr>

<? php

echo $tableRows ;

? >          
</table>

In the browser I'm seeing the html source, e.g. I see:
<tr><td>10:00 AM</td><td class="success">Available</td></tr> 
<tr><td>10:15 AM</td><td class="success">Available</td></tr> 
<tr><td>10:30 AM</td><td class="success">Available</td></tr> 

instead of the rendered table?  I've tried htmlentities but that's not working either. 

A:

Ummmmm.... Maybe your $tableRows variable has the HTML encoded, like this:
&lt;tr&gt;&lt;td&gt;10:00 AM&lt;/td&gt;&lt;td class=&quot;success&quot;&gt;Available&lt;/td&gt;&lt;/tr&gt; 
&lt;tr&gt;&lt;td&gt;10:15 AM&lt;/td&gt;&lt;td class=&quot;success&quot;&gt;Available&lt;/td&gt;&lt;/tr&gt; 
&lt;tr&gt;&lt;td&gt;10:30 AM&lt;/td&gt;&lt;td class=&quot;success&quot;&gt;Available&lt;/td&gt;&lt;/tr&gt;

In that case:
...
</tr>

<? php

echo html_entity_decode($tableRows);

? >          
</table>

