I would like to know if there is a possibility to update a field in mysql, if you can see what was previously to add the new amount.
I have a field of units that has an XX value and I want to add a new quantity. Normally I make a query first to see that value and then in an update add the old value with the new one.
Can it be simplified?
the code I usually use is this:
$CExisteArti = Consulta_Dinamica("Simple","*","Stock","'idarticulo' = '".$CExisteEan["idcosa"]."' AND 'almacen' = '".$_POST['AValmacen']."' AND 'idEan' = '".$CExisteEan["id"]."' ");
$Nstock = $CExisteArti["stock"] + $_POST["AVcantidad"];
$ModStock = Actualizar_Datos("Stock" , "'stock' = '$Nstock' ","idarticulo","".$CExisteEan["idcosa"].""," AND 'almacen' = '".$_POST['AValmacen']."' ");
It is not that it is vital to do it in a single consultation, it is simply to simplify and add knowledge.
Thousand thanks to everyone.