更新查询在 PHP MySQL 中不起作用


update query not working in php mysql

$values = array ("amount_due"=>$_POST['amount_due']); 
$where = "client_code = '".$_POST['client_code']."'";
$db->UpdateQuery ("due_amount", $values, $where);
where 子句

不起作用。 如果我不使用 where 子句,则所有行都会更新,而不仅仅是一行。

以下是可能的解决方案:

  1. 删除不必要的引号

    $where = "client_code = '".$_POST['client_code']."'";

    将其更改为:

    $where = "client_code = '".$_POST['client_code'].'"";

    引号内的引号应反斜杠

  2. 将变量"where"更改为其他内容。这是一个常量变量(我认为(