代码之家  ›  专栏  ›  技术社区  ›  kelvin

使用tinymce编辑器时,我的数据不会发布到数据库中

  •  1
  • kelvin  · 技术社区  · 7 年前

    我真的需要帮助,因为这实际上是我第一次在网站上使用所见即所得编辑器。 这是文本区域的代码: <textarea title="news" id="news" name="news" class="form-control col-md-7 col-xs-12"></textarea> 以及tinymce集成:

    <script>
            tinymce.init({
                selector: '#news',
                browser_spellcheck: true,
                branding: false,
                height: 400,
                menu: {
                    file: {title: 'File', items: 'newdocument'},
                    edit: {title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall'},
                    insert: {title: 'Insert', items: 'link media | template hr'},
                    view: {title: 'View', items: 'visualaid'},
                    format: {title: 'Format', items: 'bold italic underline strikethrough superscript subscript | formats | removeformat'},
                    table: {title: 'Table', items: 'inserttable tableprops deletetable | cell row column'},
                    tools: {title: 'Tools', items: 'spellchecker code'}
                },
                menubar: 'file edit insert view format table tools help',
                toolbar: ['undo', 'redo','searchreplace', 'preview'],
                plugins: [ 'code', 'lists', 'autolink', 'preview', 'searchreplace', 'wordcount'],
                encoding: 'xml'
            });
        </script>
    

    我现在的问题是,当我尝试将值插入数据库时,它会第一次插入,但不会插入连续的值。这是我的插入代码:

    $ins->insert('headline', array('id'=>'','post_id'=>$pi_id,'post_cat'=>$cat,'post_title'=>$title,'post_cont'=>$content));
    

    1 回复  |  直到 7 年前
        1
  •  0
  •   kelvin    7 年前

    我想我会自己回答这个问题,我犯了一个非常愚蠢的错误,我发现是撇号导致了这个错误。我用bindParam解决了这个问题。您也可以使用addslashes()函数来实现这一点。