gpt4 book ai didi

php - jEditable 有问题

转载 作者:行者123 更新时间:2023-11-29 02:35:10 26 4
gpt4 key购买 nike

jeditable 的问题。想要即时更改用户信息但它不起作用:在调试期间它显示 POST to change.php ok,没有错误,没有成功。我哪里错了?

我的代码(index.php)

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="js/jquery.jeditable.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$(".dblclick").editable("change.php", {
submitdata : {userid: "<?=$id?>"},
id : 'elementid',
name : 'newvalue',
indicator : "<img src='styles/images/ui-anim_basic_16x16.gif'>",
tooltip : "click to edit",
event : "dblclick",
style : "inherit"
});
});
</script>
...
<div id="fullname" class="dblclick" ><?=$person->fullname?></div>

改变.php

<?php
require 'db.php';
$id=$_POST['userid'];
$field=$_POST['elementid'];
$newvalue=$_POST['newvalue'];
if(isset ($id) && isset($field) && isset($newvalue) )
{$query = $db->query("UPDATE usr_table SET '$field'='$newvalue' WHERE id = '$id'") or die(mysqli_errno());
}
?>

最佳答案

尝试将您的代码更改为以下内容:

<?php
require 'db.php';
$id=$_POST['userid'];
$field=$_POST['elementid'];
$newvalue=$_POST['newvalue'];
if(isset ($id) && isset($field) && isset($newvalue) )
{
$query = $db->query("UPDATE usr_table SET '$field'='$newvalue' WHERE id = '$id'") or die(mysqli_errno());
echo $newvalue;
}
?>

关于php - jEditable 有问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6402469/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com