MYSQL数据库列未更新

时间:2014-05-28 22:14:50

标签: php mysql

请大家,我需要你帮助更新mysql数据库。以下是代码:

$sql_1 = "UPDATE tbl_courier
          SET status = '$status', 
              comments = '$comments', 
              aarrival = '$aarrival', 
              transferdate = '$transferdate', 
              bl = '$bl', 
              `containerno` = '$containerno', 
              eta = '$eta', 
              rev_name = '$Receivername'
           WHERE cid = $cid
              AND cons_no = '$cons_no'";

  dbQuery($sql_1);

除了containerno,eta和rev_name

之外,每个列都使用新输入进行更新

我做错了什么,请帮助...

1 个答案:

答案 0 :(得分:1)

据我所知,有一条线不合适。改变这个:

$sql_1 = "UPDATE tbl_courier
          SET status = '$status', 
              comments = '$comments', 
              aarrival = '$aarrival', 
              transferdate = '$transferdate', 
              bl = '$bl', 
              `containerno` = '$containerno', 
              eta = '$eta', 
              rev_name = '$Receivername'
           WHERE cid = $cid
              AND cons_no = '$cons_no'";

  dbQuery($sql_1);

对此:

$sql_1 = "UPDATE tbl_courier
          SET status = '$status', 
              comments = '$comments', 
              aarrival = '$aarrival', 
              transferdate = '$transferdate', 
              bl = '$bl', 
              containerno = '$containerno', 
              eta = '$eta', 
              rev_name = '$Receivername'
           WHERE cid = $cid
              AND cons_no = '$cons_no'";

  dbQuery($sql_1);

这一行在这里:

`containerno` = '$containerno',

我相信你不需要在专栏之前和之后的tilda。

旧行:

`containerno` = '$containerno',

新行:

containerno = '$containerno',

当您添加tildas时,如您所见。它导致语法的其余部分无效。