Ver Mensaje Individual
  #3 (permalink)  
Antiguo 22/12/2008, 14:46
darkmcloud
 
Fecha de Ingreso: octubre-2007
Mensajes: 191
Antigüedad: 17 años, 7 meses
Puntos: 0
Respuesta: Actualizar Varios Registros con un Boton Submit

primero que todo gracias por tu pronta respuesta Myakire, y bueno, como dices los nombres de clave (o codigo), descripcion y precio tienen el mismo nombre en el formulario....de hecho este es el codigo de ese formulario :

Código asp:
Ver original
  1. <%
  2.  
  3.    
  4. set Cnn=Server.CreateObject("ADODB.Connection")
  5.     set rs=Server.CreateObject("ADODB.Recordset")
  6.     Cnn.Open Session("cnx")
  7.  
  8.  
  9. strSQL = "SELECT * FROM FACPVAL "
  10.  
  11. set rs = Cnn.Execute(strSQL)
  12.          
  13.        
  14. %>
  15.  
  16.  
  17. <form name="frmClientes" method="post" action="validar_factura.asp">
  18.  <table >
  19.  
  20. <tr>    
  21. <td width="201" height="32">Código</td>
  22. <td width="465"> Descripcion: </td>
  23. <td width="289">Precio Costo:</td>
  24.  
  25. <tr>
  26.  
  27. <%do  while not rs.EOF %>
  28. <td width="201" >
  29. <input name="codigo" value="<%=RS.Fields("codigo")%>" size=12 > </td>
  30.          
  31. <td width="465">
  32. <input name="detalle" value="<%=RS.Fields("detalle")%>" size=40></td>
  33.  
  34. <td width="289">
  35. <input  name=precio value="<%=RS.Fields ("precio")%>"  ></td>
  36.    </tr>
  37.  
  38. <%rs.MoveNext
  39.       loop
  40.       %>
  41.  
  42.     <tr>
  43.        
  44. <td >
  45.        
  46. <input id=submit1 type=submit value=Aceptar name=submit1>
  47.  
  48.          </div></td>
  49.       </tr>
  50.     </table>
  51.   </div>
  52. </FORM>


y bueno...al recibir los datos los estaba haciendo asi :

validar_factura.asp
Código asp:
Ver original
  1. <%
  2.  
  3. if Not IsEmpty(Request.Form("codigo")) then
  4.      codigo = Request.Form("codigo")
  5.  
  6.     codigo = "'" & replace(codigo,",","','") & "'"
  7.  
  8. end if
  9.  
  10. if Not IsEmpty(Request.Form("detalle")) then
  11.      detalle = Request.Form("detalle")
  12.   end if
  13.  
  14. if Not IsEmpty(Request.Form("precio")) then
  15.      precio = Request.Form("precio")
  16.   end if
  17.  
  18.  
  19. set Cnn = Server.CreateObject("ADODB.Connection")
  20. set rs = Server.CreateObject ("ADODB.Recordset")
  21. Cnn.Open Session("cnx")
  22.  
  23.  
  24. strSQL = "UPDATE FACPVAL set descripcion =("&detalle&"), precio = ("&precio&")  where codigo in ("&codigo&")"
  25.  
  26.  
  27. RESPONSE.WRITE (strSQL)
  28.  
  29. %>

y Bueno...al imprimir en pantalla la consulta me aparece esto :


Código PHP:
UPDATE FACPVAL 
set descripcion 
=(BANDEJA EVAPORACION EMBRACOCT ALIM PLACA 1 R15), precio = (1901766
where codigo in ('001251082',' 009232214'
Y bueno...en el ejemplo que tu colocas del split no veo la clausula WHERE....sera que no va ??? aps....y siempre los datos de los 3 campos vienen llenos....(ya controlo en otro formulario eso....)