I need to return some HTML code stored as a text data type in my database. Is there a way to return this HTML effiencly through PHP that will execute this code when HTML parses the page? Currently I have this:
$result = @mysql_query("SELECT * FROM sponsors");
$num_rows = mysql_num_rows($result);
?>
document.write('<table align="center">');
<?
if($num_rows == 0)
{
?>
document.write('<p>No sponsors at this time</p>');
<?
}
else
{
for($i=0; $i<$num_rows; ++$i)
{
$text = mysql_result($result,$i,"html");
?>
document.write('<tr align="center"><td>');
document.write('<p><?=$text;?></p>');
document.write('</td></tr>');
<?
}
}
?>
document.write('</table>');
<?
This works for normal text but not HTML or jscript etc. Any suggestions?