You're using two reserved words, right
and values
Wrap those words in backticks, or choose different words for your table and columns.
$query=("UPDATE `values` SET max=max+$value, `right`=`right`+$value WHERE
id IN ($placement_id)";
However, max
could also play tricks on you, so wrap that in backticks also. It's an aggregate function.
$query=("UPDATE `values` SET `max`=`max`+$value, `right`=`right`+$value WHERE
id IN ($placement_id)";
Having error reporting on, would have signaled the errors:
error_reporting(E_ALL);
ini_set('display_errors', 1);
Since it seems like you're using PDO (and tagged as such): $pdo->$query($query);
Add $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
right after the connection is opened.
Sidenote: Your present code is open to SQL injection. Use prepared statements, or PDO with prepared statements. The latter being what you seem to be using as an MySQL API library.
Quoting spencer7593
from a comment:
"Also, setting PDO::ERRMODE_EXCEPTION
on the connection will cause PDO to throw errors. (This isn't the most appropriate approach, I'm not recommending this in all cases. But if we're not going to bother writing code to perform the check, to see whether a statement succeeded or not, we'd let MySQL errors go unnoticed, with the default PDO::ERRMODE_SILENT
".