MySQL скрипт обновления не обновляет базу данных - PullRequest
0 голосов
/ 20 января 2019

У меня есть запрос на обновление, который не обновляет базу данных. Я подтвердил, что условие 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();
    }   
}
...