The success statement shows after i input the quantity i want to add but my update statement doesn't seem to be updating my database and but I have no idea why, , I've used the same code elsewhere in my code and it works fine.
<?php
include 'includes/session.php';
if(isset($_POST['edit'])){
$id = $_POST['id'];
$name = $_POST['name'];
$quantity = $_POST['quantity'];
try{
$stmt = $conn->prepare("UPDATE stock_list SET quantity=:quantity+'$quantity' WHERE id=:id");
$stmt->execute(['quantity'=>$quantity, 'id'=>$id]);
$_SESSION['success'] = 'Stock updated successfully';
}
catch(PDOException $e){
$_SESSION['error'] = $e->getMessage();
}
$pdo->close();
}
else{
$_SESSION['error'] = 'Fill up edit Stock form first';
}
header('location: stockin.php');
?>