1

这是我的代码。我想在 fckeditor 中编辑内容或值。此代码正在运行插入和选择查询,但无法更新。请帮我解决它。

下面是从数据库接收一个 id 来选择记录

<?php 
    if (isset($_REQUEST['editncontent'])) {
        $editnews  = new DBConnection();
        $condition = "WHERE id = '".$_REQUEST['editncontent']."'";
        $selnews   = $editnews->SelectRecord(array("*"),"pages","$condition");

        while ($getnews = mysql_fetch_array($selnews)){ ?>
            <form action="" method="post">
            <?php
                $oFCKeditor = new FCKeditor('FCKeditor1');
                $oFCKeditor->BasePath = 'fckeditor/';
                $oFCKeditor->Width = 740;
                $oFCKeditor->Height = 600;
                $oFCKeditor->Value  = $getnews['content'];
                echo $oFCKeditor->Create();
            ?>
            </form>
<?php } } ?>

// Now it takes the parameter and going to update it         
// Update query

<?php  
    if (isset($_REQUEST['content'])) {
        $content = mysql_real_escape_string(trim($_POST['FCKeditor1']));

        $obj        = new DBConnection();
        $arr_field  = array("content");
        $arr_values = array("$content");
        $condition  = "WHERE id = '".$_REQUEST['editncontent']."'";
        $update     = $obj->UpdateRecord(
            "pages",$arr_field,$arr_values,"$condition"
        ) or die(mysql_error());
        header("Location:showpages.php");
    }
    ob_flush();
?>
4

0 回答 0