Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 剑道格网点击新建更新按钮无需努力_Php_Jquery_Mysql_Kendo Ui_Kendo Grid - Fatal编程技术网

Php 剑道格网点击新建更新按钮无需努力

Php 剑道格网点击新建更新按钮无需努力,php,jquery,mysql,kendo-ui,kendo-grid,Php,Jquery,Mysql,Kendo Ui,Kendo Grid,我使用剑道UI网格并连接到Mysql, 函数update和read是可以的,但是当我使用create并在新行中输入一些数据时,我单击了update,但它没有任何效果。 我不知道怎么了? 我的网格是: $("#grid").kendoGrid({ dataSource: { transport: { read: "data/channels.php", update: {

我使用剑道UI网格并连接到Mysql,
函数update和read是可以的,但是当我使用create并在新行中输入一些数据时,我单击了update,但它没有任何效果。 我不知道怎么了? 我的网格是:

$("#grid").kendoGrid({
        dataSource: {
            transport: {
                read: "data/channels.php",
                update: {
                    url: "data/channels.php",
                    type: "POST"
                },
                create: {
                    dataType: "json",
                    url: "data/channeladd.php",
                    type: "POST"
                }
            },
            schema: {
                data: "results",
                model: {
                    id: "channelId",
                    fields: {
                        channelName: { validation: { required: true} }
                    }
                }
            }
        },
        columns: [{ field: "channelName", title: "Channel Name" }, { field: "channelIp", title: "Channel Ip" }, { field: "channelPort", title: "Channel Port" }, { command: ["edit", "destroy"], title: " ", width: "172px" }],
        editable: "inline",
        navigable: true,  // enables keyboard navigation in the grid
        toolbar: [ "create" ]  // adds save and cancel buttons
    });
在channeladd.php中:

$link = mysql_pconnect("localhost", "root", "THE PASSWORD") or die("Unable To Connect To Database Server");
mysql_select_db("THE DB") or die("Unable To Connect To THE DB");

// add the header line to specify that the content type is JSON
header("Content-type: application/json");

    $request = json_decode(file_get_contents('php://input'));

    // DISCLAIMER: It is better to use PHP prepared statements to communicate with the database.
    //             this provides better protection against SQL injection.
    //             [http://php.net/manual/en/pdo.prepared-statements.php][4]

    // get the parameters from the get. escape them to protect against sql injection.

    $channelnName = $request["channelName"];
    $channelnIp = $request["channelIp"];
    $channelnPort = $request["channelPort"];

    $sql = "INSERT INTO channel (channelName, channelIp, channelPort) VALUES (".$channelnName.",".$channelnIp.",".$channelnPort.")";

    $rs = mysql_query($sql);

    if ($rs) {
        echo true;
    }
    else {
        header("HTTP/1.1 500 Internal Server Error");
        echo false;
    }


感谢您的建议。

很抱歉,我不知道原因,但当我删除该行时:

header("Content-type: application/json");

任何操作都可以。感谢您的关注,Deepu:)

我单击了更新,但它没有做任何努力。您的意思是什么?您是否检查了控制台的错误。?如图所示,我单击右侧的更新按钮,但它没有做任何努力,即UI更新或更改数据库表的数据(插入sql命令)。我使用google crome进行检查,并且控制台没有任何错误。