Ver Mensaje Individual
  #7 (permalink)  
Antiguo 07/12/2012, 08:49
ignatar20
 
Fecha de Ingreso: abril-2012
Ubicación: Malaga
Mensajes: 46
Antigüedad: 12 años, 1 mes
Puntos: 0
Respuesta: Cajas de texto

Ya lo he solucionado.
Ahora estoy con otro código, pero tengo un problema y es que cuando le digo que me coja el precio que hay en la tabla, no me lo coge y pone "resource".

Este es el código que tengo:
Código PHP:
Ver original
  1. <?php
  2.     function vender ()
  3.     {
  4.         $nom = $_GET["prd1"];
  5.         $nom1 = $_GET["prd2"];
  6.         $nom2 = $_GET["prd3"];
  7.         $nom3 = $_GET["prd4"];
  8.         $can = $_GET["can1"];
  9.         $can1 = $_GET["can2"];
  10.         $can2 = $_GET["can3"];
  11.         $can3 = $_GET["can4"];
  12.         if($con = mysql_connect("localhost","root",""))
  13.         {
  14.             if($sel = mysql_select_db("facturizacion",$con))
  15.             {
  16.                 echo("<input type=text value=NOMBRE><input type=text value=CANTIDAD><input type=text value=PRECIO><input type=text value=PRECIO_TOTAL><br>");
  17.                 if($nom !="")
  18.                 {
  19.                     $pre = mysql_query("select cantidad from productos where nombre='".$nom."'");
  20.                     $tot = $can * $pre;
  21.                     echo("<input type=text value=".$nom."><input type=text value=".$can."><input type=text value=".$pre."><input type=text value=".$tot."><br>");
  22.                 }
  23.                 if($nom1 !="")
  24.                 {
  25.                     $pre1 = mysql_query("select precio from productos where nombre='".$nom1."'");
  26.                     $tot1 = $can1 * $pre1;
  27.                     echo("<input type=text value=".$nom1."><input type=text value=".$can1."><input type=text value=".$pre1."><input type=text value=".$tot1."><br>");
  28.                 }
  29.                 if($nom2 !="")
  30.                 {
  31.                     $pre2 = mysql_query("select precio from productos where nombre='".$nom2."'");
  32.                     $tot2 = $can2 * $pre2;
  33.                     echo("<input type=text value=".$nom2."><input type=text value=".$can2."><input type=text value=".$pre2."><input type=text value=".$tot2."><br>");
  34.                 }
  35.                 if($nom3 !="")
  36.                 {
  37.                     $pre3 = mysql_query("select precio from productos where nombre='".$nom3."'");
  38.                     $tot3 = $can3* $pre3;
  39.                     echo("<input type=text value=".$nom3."><input type=text value=".$can3."><input type=text value=".$pre3."><input type=text value=".$tot3."><br>");
  40.                 }
  41.             }
  42.         }
  43.     }
  44.     vender();
  45. ?>