我敢肯定我错过了一些非常简单的东西,我已经多次运行了mysql更新脚本,但是这将无法正常工作,我也无法理解为什么。
单击更新按钮时,我正在将数据库中的数据调用到ckeditor文本框中,此脚本运行,我会收到成功消息,但数据库未更新我所缺少的内容???

session_start();
include ("mysql-connect.php");
include ("check-login.php");
if(isset($_POST['editblogbody'])){
      if($_POST['editblogbody'] != "" && $_POST['editblogtitle'] != "" && $_POST['blog_id'] != ""){
          $title = $_POST['editblogtitle'];
          $body = $_POST['editblogbody'];
          $bid = $_POST['blog_id'];
          $sql = mysql_query("UPDATE blogs SET title='$title', body='$body' WHERE id='$bid'")or die (mysql_error());
          echo '<img src="../_Images/round_success.png" alt="Success" width="31" height="30" />Success 1';
          exit();
      }
      else{
          echo '<img src="../_Images/round_success.png" alt="Success" width="31" height="30" />Success 2';
          exit();
      }
}
else{
    echo '<img src="../_Images/round_error.png" alt="Error" width="31" height="30" /> &nbsp; Opps something went wrong. Please Try again.';
    exit();
}


发布表格的脚本

$('#editblog').on('submit', function (e) {
    e.preventDefault();
    $('input[type=submit]', this).attr('disabled', 'disabled');
    var blogTitle = $("#editblogtitle").val();
    var blogText = CKEDITOR.instances['editblogbody'].getData();
    var url = "../_Scripts/edit-blog.php";
    if (!blogTitle) {
        $('input[type=submit]', this).removeAttr('disabled');
        $("#blogeditreply").html('<img src="../_Images/round_error.png" alt="Error" width="31" height="30" /> &nbsp; Please type a Title.').show().fadeOut(6000);
        return false;
    } else if (!blogText) {
        $('input[type=submit]', this).removeAttr('disabled');
        $("#blogeditreply").html('<img src="../_Images/round_error.png" alt="Error" width="31" height="30" /> &nbsp; Please type in your Blog.').show().fadeOut(6000);
        return false;
    } else {
        $("#blogFormProcessGif").show();
        for (instance in CKEDITOR.instances) {
            CKEDITOR.instances['blogbody'].updateElement();
        }
        $.post(url, $('#editblog').serialize(), function (data) {
            $("#jqueryReply").html(data).show().fadeOut(6000);
            $("#blogFormProcessGif").hide();
            $.modal.close();
        });
    }
});


连接失去了像这样

define('HOSTNAME','#');
define('DB_USERNAME','#');
define('DB_PASSWORD','#');
define('DATABASE','#');
$link = mysql_connect(constant('HOSTNAME'), constant('DB_USERNAME'), constant('DB_PASSWORD')) or die("Database connection error, please check!"); mysql_select_db(constant('DATABASE'), $link) or die("Connection to the defined database not possible, please check!");


我可以很好地回显所有变量,所以所有信息都在那里

谢谢

最佳答案

您会获得哪个成功答案?
“成功1”或“成功2”

10-05 20:34
查看更多