Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/04/2013, 09:58
lramirez
 
Fecha de Ingreso: febrero-2013
Mensajes: 66
Antigüedad: 11 años, 3 meses
Puntos: 1
problema de bariables

SALUDOS BUEN DÍA TENGO UN PROBLEMA CON LAS VARIABLES
LO QUE QUIERO HACER ES LO SIGUIENTE:
MEDIANTE UNA CONSULTA BUSCAR UN PRODUCTO HE IMPRIMIR SU EXISTENCIA Y CANTIDAD Y POR MEDIA DE UNA ÁREA DE TEXTO INGRESAR UN NUMERO A SUMAR Y MODIFICAR LAS EXISTENCIAS EN LA BASE DE DATOS ESTE ES EL CÓDIGO:
Código PHP:
Ver original
  1. <?PHP
  2. //Conexi贸n con el servidor
  3. $con=mysql_connect("localhost","root","");
  4.    if (!$con){die('ERROR DE CONEXION CON MYSQL:'. mysql_error());}
  5. /********* CONECTA CON LA BASE DE DATOS  **************** */
  6. $database = mysql_select_db("inventario",$con);
  7. if (!$database){die('ERROR CONEXION CON BD:'.mysql_error());}  
  8. /* ****************************************************** */
  9.  $SQL="Select*From existencias WHERE producto='".$_POST['producto']."'";
  10.  
  11.  
  12.  if($resultado = mysql_query($SQL,$con))
  13. {
  14. while($fila = mysql_fetch_array($resultado))
  15. {
  16.  echo"<table width='200' border='1' align='center'>";
  17.   echo" <tr>";
  18.  echo" <tr width='51'>&nbsp;</tr> ";
  19.    echo" </tr>";
  20.    
  21.   echo" <tr>";
  22.     echo" <td width='54'>cantiad</td>";
  23.     echo" <td width='67'>consumible</td>";
  24.   echo" </tr>";
  25.   echo" <tr>";
  26.    echo"  <td><textarea rows=1 cols=20      name=cantidad >".$fila['cantidad']."</textarea></td>";
  27.      echo"<td><textarea rows=1 cols=20      name=consumible >".$fila['producto']."</textarea></td>";
  28.   echo" </tr>";
  29.  echo"</table>";
  30. }
  31. }      
  32. else{echo '<p>'.mysql_error().'</p>';}
  33.  
  34.  echo"<table width='200' border='1' align='left'>";
  35.   echo" <tr>";
  36.     echo" <td width='54'>cantiad</td>";
  37.   echo" </tr>";
  38.   echo" <tr>";
  39. echo"<td><textarea rows=1 cols=20 name=cantidad2></textarea></td>";
  40.   echo" </tr>";
  41.  echo"</table>";
  42.  
  43. $cantidad2 = cant;
  44.  
  45. $num= $_POST['cantidad'];
  46. $num1=$_POST['cant'];
  47. $numero_uno = $num;
  48.  $numero_dos =$num1;
  49.  $suma_total = $numero_uno+$numero_dos;
  50.  
  51.  echo "la cantidad de consumibles es   $suma_total";
  52.  
  53. ?>