I'm trying to bind the parameter "userShort" from my SESSION together with some other values into my pdo statement. But everytime I run it, it updates the user column with a NULL value while all other columns get updated with the correct value. Where is my mistake?
$stmt = $conn->prepare('UPDATE productionplanning
SET '.$column.' = :value,
lastChange = :timestamp,
user = :worker
WHERE idproductionplanning = :id');
$stmt->bindValue(':value', $value);
$stmt->bindValue(':timestamp', $timestamp);
$worker = $_SESSION['userShort'];
$stmt->bindParam(':worker', $worker, PDO::PARAM_STR, 4);
$stmt->bindValue(':id', $id);
When I var_dump my SESSION it shows that userShort really does have a value:
["userShort"]=> string(2) "MK"
The column is of the type VARCHAR(4) and I'm calling the UPDATE statement through ajax. Am I just stupid for not seeing my mistake? Also, I'm pretty new to php/pdo/mysql, so I appreciate every help even if it seems stupid to you.