$x = 5;
$stmt = $db->prepare('UPDATE ' . $table. ' SET sort = sort + 1') ;
$stmt->execute();
How can I execute the query only for those values in sort
column which are equal or higher than $x
?
$x = 5;
$stmt = $db->prepare('UPDATE ' . $table. ' SET sort = sort + 1') ;
$stmt->execute();
How can I execute the query only for those values in sort
column which are equal or higher than $x
?
Simply add it to as where statement:
$stmt = $db->prepare('UPDATE ' . $table. ' SET sort = sort + 1 where sort >= ?') ;
$stmt->bind(1, $x)