Ver Mensaje Individual
  #15 (permalink)  
Antiguo 14/07/2011, 15:06
s4vr
 
Fecha de Ingreso: julio-2011
Mensajes: 14
Antigüedad: 12 años, 9 meses
Puntos: 0
Respuesta: sumar un $post a mysql

eh aqui el problema con este código si funciona:

HTML(php):

<b>VENTA</b><br>
<form action="ventas2.php" method="post">
Cantidad: <br><input type="text" name="cantidad" /><br>
<br><input type="submit" value="+" name="add" />
</form>

PHP:

<?php
$conn=mysql_connect("xxx","xxx");
mysql_select_db("xxx");
if(isset($_POST['add'])){
$add=$_POST['cantidad'];
$query="update Inventario set Cantidad=Cantidad+$add where Producto='Cheetos' and Proveedor='Sabritas'";
mysql_query($query) or die("Cannot update");
}
?>