cnid有什么问题?
当我在PHP中使用$ _POST ['cnid']时,此方法无效。
$ _ POST ['seen']效果很好。
JavaScript:
$(document).ready(function() {
$("#conversation").click(function() {
var cnid = $(this).data('id');
$.post("messenger.php",
{ seen: "seen", cnid: "cnid" },
function() {});
});
});
HTML:
<div id="conversation" data-id="<?php echo $conversation['id']; ?>"></div>
PHP:
if (isset($_POST['seen'])) {
mysqli_query($db, "UPDATE arany_messages SET seen = 'SEEN' WHERE id = '$_POST[cnid]'");
}
答案 0 :(得分:0)
答案 1 :(得分:-1)
将{ seen: "seen", cnid: "cnid" }
更改为{ seen: "seen", cnid: cnid }