SQL PHP中的更新不会更新

时间:2015-08-30 07:22:29

标签: php

所以我有这个php项目,问题是这个代码;

try{
    $pdo->beginTransaction();


    $sql = "UPDATE lib_storeroom SET medicine_id=:med_id WHERE medicine_count = :medicine_count_prev + :medicine_qty";
    $s = $pdo -> prepare($sql);
    $s -> bindValue(':med_id', $_SESSION['med_id_pull']);
    $s -> bindValue(':medicine_count_prev', $_SESSION['med_qty']);
    $s -> bindValue(':medicine_qty', $_SESSION['replenish_qnty']);

    $s -> execute();

    $pdo->commit();
}

..并且这不会更新值。请帮忙

1 个答案:

答案 0 :(得分:0)

好像您已经切换了var1 = '1' var2 = '2' print (var1 + var2) SET条款。

请改用:

WHERE