I just added a WYSIWYG editor on my website so my users can format their content any way they want. The editor works fine and is successfully saving the html coded content on the database.
The problem is when I try to view the content from MSSQL database, here's what it shows on the webpage:
�fa)2016-03-16 12:35:19.000Pg;e)@��+�!!P�P+�fa ��`��,�!H+�H+� �����,�1 � �||�`���X���sql�1 m!���1rsode!!htmlspecialchars_decode!flyerflyer9
���9����X� ������x�����`��1�r~����X�����id!1+!connection.phpflyer_id,� x����,�hpr_id,� x����,�) ����a)���]�� �|����*?���@B�r~�������������Ya�v�&������C:\inetpub\wwwroot\123\test_en_de.phpY43ectsql�9SELECT * FROM flyer_master Where flyer_id = '9����#����)`!�@#��,��,��,��)' ��Errorresultodbc_exec� h����,�
The php code to display the content is:
<?php
include("connection.php");
$flyer_id = 43 ;
$sql = ("SELECT * FROM flyer_master Where flyer_id = '".$flyer_id."' ") or die ("Error");
$result=odbc_exec($connect,$sql)or die(exit("Error en odbc_exec"));
while(odbc_fetch_row($result))
{
$id = odbc_result($result,1);
$name = odbc_result($result,2);
$flyer = odbc_result($result,3);
}
echo $flyer;
//$a = htmlentities($flyer);
echo "<br>";
echo htmlspecialchars_decode(flyer);
//echo $de_code = html_entity_decode($flyer);
//echo $de_code = htmlspecialchars($flyer ,ENT_QUOTES, 'UTF-8');
?>
Can you please help me correct this code so the html coded text is displayed properly? Or, is there another way to do this?
Note i m using php+odbc+Microsoft SQL Server 2008 R2 (RTM).