↧
Answer by Barmar for if - else in multiple update in one query
Set a variable based on the condition.Also, you don't need to use prepare() and bindParam() in the loop. You prepare and bind once, then execute in the loop. bindParam() binds to references, so you...
View Articleif - else in multiple update in one query
I have an issue with this query:foreach ($_POST['cod'] as $i => $cod) { $sth = $conn->prepare("UPDATE LPRODALMACEN SET `existencia` = `existencia` + :comprado WHERE `cod` = :cod");...
View Article