PHP : การแสดงข้อมูลที่จัดรูปแบบ html จากฐานข้อมูล sqlite บันทึกโดยใช้ Tinymce

ฉันกำลังพัฒนาแอปพลิเคชันใน php โดยใช้ฐานข้อมูล sqlite ฉันได้รวม tinymce 4.1.9 สำหรับ textarea แล้ว เมื่อฉันบันทึกข้อมูลในฐานข้อมูลสคริปต์ html ที่เหมาะสมจะได้รับการบันทึก แต่ในขณะที่แสดงข้อมูลจากฐานข้อมูลในรายงาน แท็ก html ทั้งหมดจะไม่สะท้อนให้เห็น เช่น H1 หรือรายการหรือตัวหนาไม่แสดงผล แม้แต่แท็กก็ยังถูกบันทึกไว้ในฐานข้อมูล สคริปต์มีดังนี้:

<script language="javascript" type="text/javascript" src="tinymce/js/tinymce/tinymce.min.js"></script>



<script language="javascript" type="text/javascript">

    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'}
        ]
    });

</script>

HTML :

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

การแสดงข้อมูลในรายงาน:

  <?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'];}
                ?>

โปรดแนะนำวิธีการแสดงข้อมูลที่จัดรูปแบบในรายงานหรือไม่


person user3522186    schedule 09.04.2015    source แหล่งที่มา
comment
ตรวจสอบว่ามีการใช้สไตล์ CSS และไม่ทับซ้อนกับสไตล์อื่นจาก CSS หลัก   -  person madalinivascu    schedule 09.04.2015
comment
แค่คำถามโง่ๆ คุณกำลังสะท้อน $row['AboutCompany'] ภายใน ‹text› ‹/text› พื้นที่หรือบนเพจ?   -  person MrTechie    schedule 09.04.2015
comment
ใช้ดีบักเกอร์ F12 และคัดลอกสิ่งที่คุณเห็น   -  person Hammad Khan    schedule 09.04.2015
comment
แก้ไขปัญหาแล้ว สไตล์ชีตซ้อนทับกัน ขอบคุณที่ช่วยเหลือ   -  person user3522186    schedule 10.04.2015


คำตอบ (1)


ลองใช้ฟังก์ชัน PHP htmlentities() เพื่อแปลงอักขระเป็นรูปแบบ html แจ้งผลด้วยนะครับ.

person rattanak    schedule 09.04.2015