mercredi 8 avril 2015

PHP :Displaying html formatted data from sqlite database, saved using tinymce

I am developing application in php using sqlite database. I have integrated tinymce 4.1.9 for textarea. When I saved data in database proper html script gets saved, but while displaying data from database on reports all html tags does not reflects. e.g H1 or list or bold does not show its effect. Even tags gets saved in database. Script is as follows :


tinymce.init({ selector: "textarea", theme: "modern", plugins: [ "advlist autolink lists link image charmap print preview hr anchor pagebreak", "searchreplace wordcount visualblocks visualchars code fullscreen", "insertdatetime media nonbreaking save table contextmenu directionality", "emoticons template paste textcolor colorpicker textpattern" ], toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image", toolbar2: "print preview media | forecolor backcolor emoticons", image_advtab: true, templates: [ {title: 'Test template 1', content: 'Test 1'}, {title: 'Test template 2', content: 'Test 2'} ] });

Html : <textarea name="txtAboutComp" class="form-control" rows="5" ></textarea>


Displaying data on reports:



<?php
try
{
$sqlite = new PDO('sqlite:DigitalStorageBox.sqlite');
}
catch (PDOException $e)
{
echo 'Connection failed: ' . $e->getMessage();
}

$statement = $sqlite->prepare('SELECT distinct ID, Name, LogoPath,CompanyName,AboutCompany from Company ');

try
{
$statement->execute();
}
catch (PDOException $e)
{
echo "Statement failed: " . $e->getMessage();
return false;
}
$result = $statement->fetchAll();
$cnt=0;

foreach ($result as $row)
{ echo $row['AboutCompany'];}
?>


Please suggest how to display formatted data on reports?


Aucun commentaire:

Enregistrer un commentaire