mysql更新脚本不更新数据库

时间:2019-01-20 13:43:36

标签: mysql insert-update

我有一个不更新数据库的更新查询。我已验证满足if条件,并验证了正在发布数据。我认为这是语法错误,但我看不到它。谁能看到任何错误?

if(isset($_POST['account_id']) && isset($_POST['account_id']) !="") {
    $request_id  = $_POST['request_id'];
    $account_id = $_POST['account_id'];
    $class_id = $_POST['class_id'];
    $sub_account_id = $_POST['sub_account_id'];
    $amount = $_POST['amount'];
    $justification = $_POST['justification'];
    $last_edited_by_uid = $_POST['last_edited_by_uid'];
    $last_edited_date = $_POST['last_edited_date'];
    try{
        $stmt3 = $db->prepare("UPDATE budget_request SET account_id=:account_id, class_id=:class_id, sub_account_id=:sub_account_id, amount=:amount, justification=:justification, last_edited_by_uid=:last_edited_by_uid, last_edited_date=:last_edited_date WHERE request_id=:request_id");
        $stmt3->bindParam(':request_id',$request_id,PDO::PARAM_INT);
        $stmt3->bindParam(':class_id',$class_id,PDO::PARAM_INT);
        $stmt3->bindParam(':account_id',$account_id,PDO::PARAM_INT);
        $stmt3->bindParam(':sub_account_id',$sub_account_id,PDO::PARAM_INT);
        $stmt3->bindParam(':amount',$amount,PDO::PARAM_STR);
        $stmt3->bindParam(':justification',$justification,PDO::PARAM_STR);
        $stmt3->bindParam(':last_edited_by_uid',$last_edited_by_uid,PDO::PARAM_STR);
        $stmt3->bindParam(':last_edited_date',$last_edited_date,PDO::PARAM_STR);
        $stmt3->execute();
        header(sprintf('Location: budget_worksheet.php?class_id='.$class_id));    
        exit();
}
    catch(PDOException $e){
        //$db->rollBack();
        //echo $e->getMessage();
        exit();
    }   
}

0 个答案:

没有答案