我一直在尝试使用ajax更新数据库中的订单表。好像我的sql没有执行或者我的语法可能有问题,我已经检查并验证我传递的id变量已经使用POST传递,并且在javascript中调用时它成功发出警报。我遇到的问题是我的表没有更新。
我的php
if(isset($_POST['completed_id']) === true) {
$comp_id = $_POST['completed_id'];
include 'http://trecoolable.koding.io/res/res_php/conn.php'; //connection successful
$sql = "UPDATE resorder_tb SET res_complete = 1 WHERE res_id =".$comp_id; //not updating, checked and names are correct
echo $comp_id; //shows when echoed into my msg in javascript
}
的javascript
$("#compacc_but").click(function(){
var completed_id = record_id;
$.ajax({
url: "http://trecoolable.koding.io/res/res_php/getOrder.php",
type: "POST",
data: {completed_id:completed_id}, ///passing correct values
success: function(msg)
{
alert(msg); //alerting properly
}
});
答案 0 :(得分:2)
你在执行$ sql语句吗?
答案 1 :(得分:0)
只需更改此代码,如下所示 -
KeyboardInterrupt